Forum

Author Topic: "Unexpected Channel Count" error  (Read 3477 times)

outsider

  • Newbie
  • *
  • Posts: 31
    • View Profile
"Unexpected Channel Count" error
« on: January 13, 2019, 09:06:08 PM »
I'm getting a "Unexpected Channel Count" error in Metashape 1.5.0 build 7492 when I run the "Build Dense Cloud" step.
The equirectangular images align just fine.

This only happens when I have Spherical (equirectangular) images in my dataset. The same spherical images worked with no problems in Photoscan 1.4.4 in the Build Dense Cloud step.

Anyone else getting this error related to spherical images?
« Last Edit: January 13, 2019, 10:07:06 PM by outsider »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #1 on: January 13, 2019, 10:49:43 PM »
Hello outsider,

Are there any extra channels in the source images?
Best regards,
Alexey Pasumansky,
Agisoft LLC

outsider

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #2 on: January 13, 2019, 11:56:03 PM »
Hi Alexey,
What do you mean by extra channels?
How do I check?

These are TIFFs generated by GoPro Fusion software. Images taken with the GoPro Fusion camera.

outsider

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #3 on: January 14, 2019, 03:00:30 AM »
It looks like it was the TIFF files.
Converted them to jpg and the software runs smoothly.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #4 on: January 14, 2019, 11:25:06 AM »
Hello outsider,

Can you please send any TIFF example that causes the error to support@agisoft.com?

We have been reported a similar issue and it has been related to the presence of the extra channel in the TIFF that hasn't been marked as alpha channel properly. So in Metashape interface in Tools Menu -> Camera Calibration dialog the fourth channel has appeared.

If there shouldn't be any alpha channel that you want to use for the masks import, you can remove it before loading TIFF images to Metashape, for example, with the help of XnView utility.
Best regards,
Alexey Pasumansky,
Agisoft LLC

jnb

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #5 on: January 14, 2019, 09:55:52 PM »
Hello,

Alexey is most likely referring to my problem (which is still going on).
In my case, it occurs only when using in the same chunk images with an alpha channel (not been marked properly as so) and images without alpha channel.

If I use only images with this 4th pseudo alpha layer, everything is working fine.

Don't know if this is helpful though.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #6 on: January 14, 2019, 10:20:43 PM »
Hello jnb,

We have been also reported about the similar issue by another user, and he has managed to solve the issue (also with Photoshop export) by finding and removing duplicated alpha channels in Photoshop, when editing masks. Can you also check, if there might be multiple extra layer samples before you  export the image from Photoshop? It might also worth trying to combine visible layers prior to export (do not confuse with Flatten layers option).
Best regards,
Alexey Pasumansky,
Agisoft LLC

jnb

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #7 on: January 17, 2019, 05:14:43 PM »
Hello Alexey,

Thank you for still trying to solve this !
Unfortunately, I have made some tests on pictures coming from a different camera, and nothing is working. I don't even have extra layer.

Here is my test workflow, in the case I am missing something but I can't figure it out :

- open image in Photoshop
- make a selection
- save selection on new channel
- save image as tiff with alpha

And that's all.

If I only use images with 4 channels, no problem. But as soon as I mix them with images without this 4th channel, I've got an error.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #8 on: January 18, 2019, 02:11:08 PM »
Hello jnb,

I am not able to reproduce the issue with Photoshop (however, I have older version).

What I can suggest is to combine the layers before exporting the images.

If you can reproduce the problem even with the smaller size images, maybe you can save the PSD (Photoshop) project and send it to us, so that we could try to use different export options to see, what might reproduce the issue?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Mike25660

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #9 on: January 26, 2019, 07:48:34 PM »
I also experienced the "Unexpected channel count" error using 1.5.0 build 7492.

This happened on a project of 216 TIFF images. 205 were masked in Photoshop so they included an alpha channel. The remaining 11 images were not masked and included no alpha channel. Photos aligned as usual and a good sparse cloud was created. The "Unexpected channel count" error occurred at the end of Dense Cloud creation.

Although no dense cloud was created, I noticed a depth map had been. I don't use depth maps but I also noticed the Mesh panel said a mesh could be created from the depth map. I tried that, and it worked even though the error occurred for the dense cloud. The Shaded, Solid, and Wireframe models looked fine.

Next, I proceeded to create a textured model. Again, the "Unexpected channel count" error occurred. This time, the Console indicated 11 images contained only 3 channels rather than 4. Those images were then disabled, and a good textured model was created. Still, no dense cloud was ever created.

I plan to create masks for those 11 images that originally didn't have them, and rerun the project with all images having masks.

Before the update to 1.5.0, I never had a problem mixing masked and unmasked TIFF images.

From the first texture attempt:

2019-01-26 06:24:55 - 100% done by [CPU 1] with timings: 2267 s = 0% fetch + 1% init + 77% hist (96% GPU) + 0% init + 21% iters (81% + 19%) + 0% updating
2019-01-26 06:24:55 IO utilization: 1%
2019-01-26 06:24:55 Level done in 2268.3 sec
2019-01-26 06:24:55 Surface estimated in 2454.16 sec
2019-01-26 06:24:55 Extracting surface...
2019-01-26 06:26:06 8513494 vertices total
2019-01-26 06:26:06 17026857 faces total
2019-01-26 06:26:06 done in 71.457 sec
2019-01-26 06:26:06 Calculating colors...
2019-01-26 06:26:09 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:09 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:09 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:10 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:10 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:12 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:12 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:13 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:13 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:13 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:26:15 Warning! Image ignored because it has 3 channels, but 4 channels expected!
2019-01-26 06:28:20 done in 133.252 sec
2019-01-26 06:28:20 Decimating surface...
2019-01-26 06:28:35 decimated to 479561 faces
2019-01-26 06:28:35 done in 15.277 sec
2019-01-26 06:28:36 Finished processing in 29467.4 sec (exit code 1)


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #10 on: January 26, 2019, 08:38:55 PM »
Hello Mike25660,

Can you please check in the Tools Menu -> Camera Calibration dialog -> Bands tab, if the masked images are actually 3 band photos and do not contain the fourth channel.

In case there is a fourth channel, it means that alpha channel is not marked properly when the data is exported from Photoshop. You can send an example of such sample image (4 band) to support@agisoft.com.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Mike25660

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #11 on: January 27, 2019, 12:53:59 AM »
Email is sent.

Mike

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14847
    • View Profile
Re: "Unexpected Channel Count" error
« Reply #12 on: February 04, 2019, 02:58:16 PM »
Hello all,

Please check if you are able to work with the same images properly now in the version 1.5.1 build 7618?

The problem seems to be related to the fact that Photoshop is saving "alpha" as fourth band and actually allows multiple alpha channels, but is not able to save the transparency as a layer, keeping the original data below it. So in Photoshop the way of creating proper masks as transparency is only possible if you move the background to the new layer and just remove the unwanted data - the area will become transparent and would work properly for the masks from alpha import in Metashape without creating any additional bands.
Best regards,
Alexey Pasumansky,
Agisoft LLC