Forum

Author Topic: manage with photoscan 4 simultaneous cameras  (Read 39561 times)

mfran2002

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #15 on: May 13, 2016, 08:41:57 PM »
Hello Alexey,
I thought if there is a way to convert GREEN, RED and BLU-NIR images from 3-channels to single channel using python scripting.

I have a huge number of images, also until thousands, so it could be very important for me

Second question: is it needed a greyscale image?

thanks!
« Last Edit: May 13, 2016, 08:56:31 PM by mfran2002 »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15691
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #16 on: May 13, 2016, 09:15:41 PM »
Hello mfran2002,

There's a possibility to re-save only single channel from the given multichannel image using Python in PhotoScan, but probably it would be easier with some dedicated image editing applications and utilities, like ImageMagic, for example.

So if the camera captures captures only single band, the output image should be also single channel image.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Paulo

  • Hero Member
  • *****
  • Posts: 1608
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #17 on: May 13, 2016, 10:25:05 PM »
Alexei,

I have downloaded two sets of Mapir Survey 2 images from Mapir example data set. One set is in red band and other in infrared.

Since these images are RGB 24 bit, I used ImageMagick to convert into 3 images (8 bit) corresponding to each band (R,G and B).

Then for each set, I kept the first band image that I put into 2 folders containing each 18 images corresponding to red band and infrared band....

However, when I use folder import in PS and specify updir (MultiSpectral_import) for both folders and use Create Multispactral cameras with folders as bands, I obtain one chunk with just the images from the Infrared band.


What is wrong here? Is there a naming convention for image files?

See attached screnn copies....
Best Regards,
Paul Pelletier,
Surveyor

Paulo

  • Hero Member
  • *****
  • Posts: 1608
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #18 on: May 13, 2016, 10:32:19 PM »
Just to add that images from both sets are not synchronized. That is 1st image of red sample set not taken at ame time as first image of Infrared set and thus do not have the same GPS position.....


Maybe this is the problem...
Best Regards,
Paul Pelletier,
Surveyor

mfran2002

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #19 on: May 13, 2016, 10:46:46 PM »
Hi Alexey,
concerning the camera captures, they have a Bayer RGB sensor, so they don't return single channel images, only 3 channels.

I have Photoshop and I hope it can be helpful for this conversion, I'm checking out how to do.

But it is very important for me to know if the single channel should be a grayscale image.

The second question: I know that the conversion could give me either a separate file for each channel in the original file, or the channels can be merges and converted to grayscale: what option has to be chosen?

thank you, also for your patience!
« Last Edit: May 13, 2016, 10:50:59 PM by mfran2002 »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15691
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #20 on: May 13, 2016, 11:16:27 PM »
Multispectral chunks are the following representation in PhotoScan: camera labels int hw Workspace pane correspond to the filenames of the images from the first folder, but for each camera there are several planes (their number corresponds to the number of imported folders) that you can access from the Tools Menu -> Camera Calibration window (the very top option in the dialog).
Multispectral chunks approach assumes that the images for each band are captured at the same time and the distance between the cameras is negligible compared ot the distance to surface. During the alignment procedure PhotoScan adjusts only orientation angles and calibration parameters for each plane.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Paulo

  • Hero Member
  • *****
  • Posts: 1608
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #21 on: May 14, 2016, 01:09:06 AM »
Thank you!

I can see now how this approch works.


However the different planes or bands were not well synchronozed as the dense point cloud obtained is very bad.

But I can see the resulting mosaic with 2 bands on which I can do calculations.
Best Regards,
Paul Pelletier,
Surveyor

Paulo

  • Hero Member
  • *****
  • Posts: 1608
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #22 on: May 14, 2016, 01:24:48 AM »
Is the dense cloud calculated on first band or on all bands?

Attached is the dense cloud generated from my PS processing of MultiSpectral MapIr import (ir and red).

It is completely wrong with points all over the space. Why is this?
Best Regards,
Paul Pelletier,
Surveyor

mfran2002

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #23 on: May 14, 2016, 09:50:39 AM »
Hello Alexey,
may you please answer also to my questions about the conversion from 3 to 1 channel for GREEN, RED, BLU-NIR cameras (the RGB camera I understand is ok to return 3-channel image)?

1. the single channel should be a grayscale image?

2. the conversion could give me either a separate file for each channel in the original file (respectively channels R, G and B), or the channels can be merges and converted to grayscale: what option has to be chosen?

thank you
 :)
« Last Edit: May 14, 2016, 10:39:39 AM by mfran2002 »

mfran2002

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #24 on: May 15, 2016, 12:28:37 PM »
Hello Alexey,
an update, please tell me if OK

concerning the conversion from 3 to 1 channel of GREEN and RED, with Photoshop I will "convert directly to grayscale using Gray gamma 2.2".

concerning BLU-NIR, following the above way I would lose information: note infact that this doesn't necessarily correspond to what is actually blue and what is actually near infrared. IR affects all three color-sensitive pixels in the Bayer array, but to differing degrees.

So, what do you think I have to do for BLU-NIR?
Thank for your help
« Last Edit: May 17, 2016, 07:46:43 AM by mfran2002 »

mfran2002

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #25 on: May 17, 2016, 03:30:43 PM »
Hi Alexey,
have you some news for my issue?
 :-[

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15691
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #26 on: May 17, 2016, 06:41:10 PM »
Hello mfran2002,

As far as I understand it from Mapir web-site, for Red and Green cameras you need to use only corresponding channel and remove other two. As for Blue-NIR camera, it's not quite clear how the data is stored, as all three channels in the image are used.

Best regards,
Alexey Pasumansky,
Agisoft LLC

mfran2002

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #27 on: May 17, 2016, 09:57:21 PM »
Hello Alexey and thanks again!

do you think it is possible to leave BLU-NIR images as they are (3 channels) with "Create multispectral cameras from folders as bands" option?

idem for RGB images

conversely, for GREEN and RED I could try to use only corresponding channel and remove other two
OR
convert them into grayscale

what do you think?
« Last Edit: May 17, 2016, 10:13:49 PM by mfran2002 »

mfran2002

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #28 on: May 18, 2016, 03:51:31 PM »
Hi again Alexei,
some post ago you wrote:

"There's a possibility to re-save only single channel from the given multichannel image using Python in PhotoScan,"
 
I think it is for me now the only possibility, may you please help me with that?
May you please write some example of statement?

thanks!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15691
    • View Profile
Re: manage with photoscan 4 simultaneous cameras
« Reply #29 on: May 18, 2016, 07:02:04 PM »
Hello mfran2002,

If you need to save the green channel from the corresponding image set, you can use the following script on the active chunk:

Code: [Select]
import PhotoScan
chunk = PhotoScan.app.document.chunk

for camera in chunk.cameras:
   image = camera.photo.image().convert("G", "U8")
   image.save(camera.photo.path[:-3] + "tif")

This operation will save the image in single-channel TIFF format in the same folder, where the original photos are present.
Best regards,
Alexey Pasumansky,
Agisoft LLC