reading and writing the viewport - page 3 - General Discussion and Assistance - CHDK Forum

reading and writing the viewport

  • 28 Replies
  • 14435 Views
Re: reading and writing the viewport
« Reply #20 on: 26 / April / 2008, 19:15:05 »
Advertisements
Creating the RAW file seemed to be OK but when reading it gave strange results (just a pattern, no image).

Maybe I did it wrong, will check tomorrow.

A number of brackets also missing from that macro, some caused by the 'smiley'.


David


Aaah  .. my input image has to be resized to 720x280 (maybe the macro can do it ?)

Hi, the 720x280 was a typo.  Should be 720x240.   

I added a line to resize the image.  Here is the correct beginning to the macro:
Code: (cpp) [Select]
//RGBtoViewport.txt
//This macro can convert an RGB image to Canon viewport data. 
//For my camera, the A720IS, the viewport data is 360x240 x 3bytes.
//Every 6 bytes in the data is encoded as U,Y1,V,Y2,Y3,Y4 in the YUV color system.
//This routine takes 4 RGB pixels and converts them to 6 bytes in the output data 
//The input RGB image is resized to  720x240. 
//The output is a 360x240 RGB image saved in raw format.

open();
setBatchMode(true);
run("Scale...", "x=[] y=[] width=720 height=240 interpolate create title=VPinput");


By the way... I just noticed that the first macro ViewportToRGB has a bug.  The output colors aren't perfect.  I will have to look into this.  My Java code works fine, but macros are a little tricky when doing integer operations.
« Last Edit: 26 / April / 2008, 19:43:59 by hiker_jon »

Re: reading and writing the viewport
« Reply #21 on: 26 / April / 2008, 19:40:49 »
the 720x280 was a typo.

I am never sure if a 'typo' is merely a 'slip of the finger' or human error  :)

Quote
Should be 720x240.

I have been trying to figure-out why it was 280 ! 


Yes, it now works fine

Nice to see you are on the ImageJ mailing list.

I am just getting SDM 1.60 ready for release and then I will see if you can save the viewport in Record mode.




David

Re: reading and writing the viewport
« Reply #22 on: 26 / April / 2008, 21:36:33 »
Found and fixed a bug in ViewportToRGB.txt  The v values for negative v were wrong.  This made a blue sky into purple.

Re: reading and writing the viewport
« Reply #23 on: 27 / April / 2008, 02:07:25 »
Hi,

It was easy to write some code that overlays an edge image from the previous shot onto the screen in shoot mode.  CHDK is certainly a lot of fun!

I will post the code in a new thread named edge overlay


*

Offline PhyrePhoX

  • *****
  • 2254
  • make RAW not WAR
    • PhyreWorX
Re: reading and writing the viewport
« Reply #24 on: 27 / April / 2008, 04:03:07 »
This 'invention' also means we can overlay the canon icons now with our own?professinally drawn icons would be great.

Re: reading and writing the viewport
« Reply #25 on: 22 / September / 2008, 15:55:23 »
It would be usefull for a lot of applications to make it possible to display a full color image using your load_viewport function on a viewport when a designated button is clicked in either REC or PLAY mode. I tried to hook on the histogram code,  but right now, on SD1000 I was able display the image only once in a PLAY mode after I turn the camera on or after I switch from REC to PLAY mode. When I click on MENU button, I can repeat it. Initially, I can load to buffer I get with vid_get_viewport_fb_d(), but I believe that viewport buffer location changes when you scroll through the saved images in PLAY mode. When you click on MENU button or switch from REC to PLAY the viewport buffer is restored to the initial buffer returned by vid_get_viewport_fb_d(). Anyone knows more about this?

Re: reading and writing the viewport
« Reply #26 on: 24 / September / 2008, 22:12:50 »
For my A720is the viewport location in play mode is constant.  I just got an A570is, however, and when I ported my code to it it seems that the viewport address in play mode is only correct for every other image.  This may be what is going on in your camera.  I will need to study my new A570is to try to figure out what is going on.


It would be usefull for a lot of applications to make it possible to display a full color image using your load_viewport function on a viewport when a designated button is clicked in either REC or PLAY mode. I tried to hook on the histogram code,  but right now, on SD1000 I was able display the image only once in a PLAY mode after I turn the camera on or after I switch from REC to PLAY mode. When I click on MENU button, I can repeat it. Initially, I can load to buffer I get with vid_get_viewport_fb_d(), but I believe that viewport buffer location changes when you scroll through the saved images in PLAY mode. When you click on MENU button or switch from REC to PLAY the viewport buffer is restored to the initial buffer returned by vid_get_viewport_fb_d(). Anyone knows more about this?

Re: reading and writing the viewport
« Reply #27 on: 29 / September / 2008, 14:11:17 »
Thanks for looking into this. What's confusing me even further is that histogram code seems to work, and it collects data using the same viewport buffer I am trying to write saved picture into...


*

Offline igor

  • *
  • 21
Re: reading and writing the viewport
« Reply #28 on: 29 / September / 2008, 15:15:30 »
Microfunguy:
>> It will give an indication of whether you have moved the camera too far or not far enough.
Do you know how to do that  ?   
You have mentioned my two favoutite applications :  CHDK   and ImageJ !

Does yours 2 camera solution implement algorithm of changing optical axes directions depending on current distance to the target. In addition to be proper, it should move those 2 cameras away or closer from each other depending on current zoom. I understand, nothing like that is currently implemented, isn't it?

« Last Edit: 30 / September / 2008, 02:44:31 by igor »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal