ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 ImageEn and ..mpo files
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Chris Landon

Uganda
3 Posts

Posted - Jul 19 2011 :  11:24:37  Show Profile  Reply
I want to have my program convert .mpo files to .jpg stereo pairs. I got a Fuji 3-D camera. It saves pictures in .mpo format, which is apparently just two jpeg images (Left and Right) put together side by side, more or less. Does ImageEn support the .mpo format in any way ? Would ImageEn software have features I would use to do this ? Anyone know anything about .mpo files or how to go about extracting the two images ? I read this on a website: Fujifilm's MPO format is not really anything special at all, it is just basically JPEG data. What they have done is simply append two industry standard JPEG/EXIF files together (left view first).

CL

fab

1310 Posts

Posted - Jul 19 2011 :  12:45:36  Show Profile  Reply
I was a little curious so here is the code to load MPO images:


procedure ReadMPO(ImageEnView:TImageEnView; filename:string; imageIndex:integer);
var
  mem_strm:TMemoryStream;
  memPtr:pbyte;
  jpeg_len:integer;
begin
  mem_strm := TMemoryStream.Create();
  try
    // load the full file into memory
    mem_strm.LoadFromFile(filename);
    // calculate the length of the first jpeg
    jpeg_len := IEGetJpegLength(mem_strm);
    memPtr := mem_strm.Memory;
    if imageIndex = 0 then
      // load the first jpeg
      ImageEnView.IO.LoadFromBuffer(memPtr, jpeg_len)
    else
    begin
      // bypass first jpeg
      inc(memPtr, jpeg_len);
      // load the second jpeg
      ImageEnView.IO.LoadFromBuffer(memPtr, mem_strm.Size - jpeg_len);
    end;
  finally
    mem_strm.Free();
  end;
end;


It loads the image in the specified TImageEnView component. imageIndex can 0 or 1 (depending if you want to load first or second image).
IEGetJpegLength is inside "jpegfilt" unit.
For example:

ReadMPO(ImageEnView1, 'dsc00065.mpo', 0);
or
ReadMPO(ImageEnView1, 'dsc00065.mpo', 1);

I tested MPO files from:

http://www.stereomaker.net/sony/stereo/sony_stereo.htm

Hope this helps.

Go to Top of Page

Chris Landon

Uganda
3 Posts

Posted - Jul 19 2011 :  15:38:28  Show Profile  Reply
Hi,

It works perfectly on my files too. Thank you very much. One thing...I have three small ImageEnView windows in my application. When showing the same image I see the first ImageEnView looks normal while the other two are too light. What is happening here ?
Go to Top of Page

fab

1310 Posts

Posted - Jul 23 2011 :  02:57:09  Show Profile  Reply
Hi,
I did not receive notification of the your new post (maybe you have just edited it).
It is a bit strange that TImageEnView shows the same image in different ways.
Please could you provide a screen shot and if possible a little project to test?
Go to Top of Page

Chris Landon

Uganda
3 Posts

Posted - Jul 23 2011 :  05:46:31  Show Profile  Reply
Hi,
Sorry, I did only edit my reply.
I could send a screen shot. But possibly not today. Very busy today. I need to make a simple program to demonstrate/test. Will try to send more info as soon as possible. For now I can simply say, I have three small ImageenViews. They are each only about an inch and a half wide. Normally two will show the first and last selected image in a source directory. The other shows a selected image in a destination directory. If only one image is selected inthe source directory, it shows in both source display windows. I can make it so the same image is selected in all three ImageEnView. If these images are .mpo files, I use the procedure above to load them. The procedure repeats three times in the code to load three ,mpo files if applicable. Only when it loads .mpo files do I see the picture shows in the second and third window is much lighter, over exposed looking. This doesn't happen when using the normal LoadFromFile to load tiffs, jpegs, bmps, etc. It happens only with the .mpo files. Give me a couple of days to put something together. In the meantime perhaps this imformatio will give you a chance to find something. If you have time, make three ImageEnViews on a form and load them ine after the other with an .mpo file. Thank you.

CL
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: