How to access pixels using pixel index in Mat::forEach?

asked 2016-10-25 06:19:26 -0600

updated 2016-10-25 21:08:27 -0600

Feature addition!

It would be great if Mat::forEach method allows us to access the neighboring pixels for interpolation! As per this Question, the current implementation of Mat::forEach method will not allow us to access the neighboring pixels.

Any help regarding this feature addition will be so helpful!

A similar implementation is the cuda kernal functions, where we can access any pixels from a single kernel! My idea is to reuse the cuda kernels code for CPU with minimum effort!

edit retag flag offensive close merge delete

Comments

it probably gets better, if you can add, what kind of problem you're trying to solve ..

berak gravatar imageberak ( 2016-10-25 06:56:23 -0600 )edit

Yes with a single kernel you can access any pixels. But I have got some difficulty to understand how with a parallel (multithread) application you can access any pixel witthout conflict

LBerger gravatar imageLBerger ( 2016-10-25 12:23:31 -0600 )edit

@LBerger Yes that make sense! We cannot access any pixel without conflict!

Balaji R gravatar imageBalaji R ( 2016-10-25 21:23:44 -0600 )edit

"So that i can Interpolate the current pixel with the neighboring pixels?"

again, maybe you can add some context here. could it be done with a filter matrix ?

berak gravatar imageberak ( 2016-10-26 03:54:40 -0600 )edit
1

No i may use pixel dependent kernal's like in demosaicing ,you need to use different interpolation methods for RGB for a single pixel!

Balaji R gravatar imageBalaji R ( 2016-10-26 05:15:29 -0600 )edit

Also i cannot use cvtcolor for demosaicing because i may need to use white balance too while demosaicing!

Balaji R gravatar imageBalaji R ( 2016-10-26 05:19:29 -0600 )edit