Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to input png or jpg stereo images for disparity map calculation #1

Open
ahsan856jalal opened this issue Nov 26, 2018 · 5 comments

Comments

@ahsan856jalal
Copy link

When I try to input .png stereo images pair instead of .pgm, it gave me this error:
"/elas img/left_1.png img/right_1.png
Processing: img/left_1.png, img/right_1.png
ERROR: Could not read file img/left_1.png
terminate called after throwing an instance of 'pnm_error'
Aborted"
Can you help me in this regard

@kou1okada
Copy link
Owner

kou1okada commented Nov 26, 2018

Read following lines:

libelas/src/main.cpp

Lines 37 to 38 in 862ee4e

I1 = loadPGM(file_1);
I2 = loadPGM(file_2);

Maybe there are two choices for you.

  1. Convert png to pgm before processing.
  2. Rewrite these lines to the function which load png file.

Good luck! 😉

@Zchappie
Copy link

Zchappie commented Jul 14, 2019

Hi @kou1okada I got the same error but I did convert all rectified images to .pgm file. I converted them through changing file extensions, is this causing errors? Here is the code in python how it calls the command line (as I need to do batch processing)

for imgid in os.listdir(img_path_0_new):   
    commandLine = str(dirpath) + "/libelas/elas " + img_path_0_new + imgid + " " + img_path_1_new + imgid  
    os.system(commandLine)

@kou1okada
Copy link
Owner

To write code in the Markdown, use triple back quotes (```).
For more details, read below:

And, your python script has no abilities to convert the image format.
Additionally, it has no abilities to change the file extension, too.
Please write correctly what you did.

@Zchappie
Copy link

Sorry I didn't make my question clear. I converted the images manually before the code. Those lines aim to call LIBELAS. And the error is same as ahsan856jalal has said.
What I want to ask is there any recommended way to do the batch image converting from png to pgm, which fulfil the requirement of LIBELAS

@kou1okada
Copy link
Owner

Maybe my post on issue #2 will be helpful.
It is using convert command of ImageMagick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants