Analyze picture in JPEG format - page 2 - General Discussion and Assistance - CHDK Forum

Analyze picture in JPEG format

  • 12 Replies
  • 5144 Views
*

Offline reyalp

  • ******
  • 14128
Re: Analyze picture in JPEG format
« Reply #10 on: 01 / March / 2015, 02:38:25 »
Advertisements
Could anyone tell me more about the raw buffer's content? I am now trying to replace all the green or some other color that is near green to red. I am using the function of rawop_get_pixels_rgbg and rawop_set_pixels_rgbg(same content, just change the API to fit for C). I am using the filter of ((g1>800||g2>800)&&r<600&&b<600), but it seems it can only detect a really small amount of green object in the picture. Is there any fomular or some reference material to show the relation between actual color the rgbg code(for example, change rgbg into standard RGB)?
The "rgbg" function just work on a four adjacent pixels like
R G
G B
and gives you the correct pixels for whatever you bayer pattern is. If you want RGB color like you would get in a jpeg, you need to correct for the filters different responses. The color matrix should help you do this in theory, but it may or may not be accurate for any given port. The dng specification has some information.

Depending your needs, you may not need full color calibration. If you just want to find out if a part of the scene is strongly green, some ad-hoc coefficients might be enough. The drtest.lua script can help you see the relative responses.

I'm not sure what you mean by "an only detect a really small amount of green object in the picture"
Don't forget what the H stands for.

Re: Analyze picture in JPEG format
« Reply #11 on: 01 / March / 2015, 03:04:17 »
I'm not sure what you mean by "an only detect a really small amount of green object in the picture"
Please check the attachment it's a screen from the picture I took(because of the size limitation of attachment), you can see that at the right edge of the card reader some of the pixels are changed to red. My expected effect is that the whole card reader should be displayed in red.

*

Offline reyalp

  • ******
  • 14128
Re: Analyze picture in JPEG format
« Reply #12 on: 01 / March / 2015, 03:40:49 »
Please check the attachment it's a screen from the picture I took(because of the size limitation of attachment), you can see that at the right edge of the card reader some of the pixels are changed to red. My expected effect is that the whole card reader should be displayed in red.
OK, that makes sense. I'd suggest looking at the raw data to find out what the actual raw pixel values in the area that didn't get marked are. You can do this on a PC if you take a DNG and convert it to some 16 bit format without demosaicing. You could also use in camera code to build an RGB histogram of the area in question.

From the previous post
Quote
I am using the filter of ((g1>800||g2>800)&&r<600&&b<600)
I'd suggest you probably want to look a the ratio of green to other values, rather than fixed values. Note that green is generally more sensitive so for uncalibrated raw on a neutral background g will get further from r and b as exposure increases.
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal