D-Alex / ropencv

ffi ruby wrapper for opencv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pixel by pixel processing

nicholasjhenry opened this issue · comments

What is the most efficient method for pixel by pixel processing/manipulation using ropencv? With the C++ interface this could be done use ptr function on Mat or an cv::Mat_<cv::Vec3b>::iterator. Thank you for you help.

The most efficient way would be to directly access the mat.data field via ffi and do the offset by yourself.

  • mat.data.put_uint8(step_row,col_channels+channel,val) -> (this will most likely crash if the offset is wrong)

Usually, I write all algorithm in c++ and use rbind to generate ruby bindings which are compatible to ropencv
(an example can be found here https://gitorious.org/rock-image-processing/frame_helper branch rbind). The only problem here is that rbind is still not finished and a bit cumbersome.

I apologize for my late response! Thank you for that info -- very helpful.