Ask Your Question

Pixel Subraction + Gain - Realtime Video

asked 2015-06-06 12:34:30 -0500


I need to write a program for real-time processing a laser interferometer video image. The processing is fairly simple, and similar to background detection.

I need the real-time display of one video frame subtracted from the previous frame (with no compression or other alterations of the pixel data from the camera), and with a variable gain (i.e. the result multiplied by perhaps 1 - 20).

I am using c++ (however, I am just learning the basics at this point).

If anyone can help point me in the right direction with regard to which opencv library algorithms to use I'd appreciate it.

Perhaps a part of a background detection code can be used with minor tweaks?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-06-06 14:02:05 -0500

updated 2015-06-06 14:05:56 -0500

Here is a list of functions that to similar stuff:

Just adding and scaling can be written as

cv::Mat result = 5* (current_image - last_image)

although this can be probematic e.g. for 8UC1 matrices as some differences can get negative. For that reason, you could use cv::subtract that checks the boundaries of the dataype.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-06-06 12:34:30 -0500

Seen: 109 times

Last updated: Jun 06 '15