Have you tried
if (im1 > im2) im3 = 1;
else im3 = -1;
Maybe a comparison runs faster than 4 aritmetics...
openvictor Open wrote:
> Dear all,
> Here is my problem : I am trying to do a background update by adding a
> fixed quantity (for simplicity let's say +1 or -1) depending on the
> substraction of two images.
> For example : we have a first image im1 and a second im2
> We do im1 - im2 = im3.
> I want im3 to just keep the "sign" of the substraction ( the +1 and
> -1) I don't want to have the result of the actual substraction, let's
> say if one element of im3 is +93 I want it to be +1 if it's -25 I want
> it to be -1.
> The only way I think of is :
> 1. im1 - im2 , take the threshold for element superior or equal to 1,
> 2. im2 - im1 take the threshold for elements superior or equal to 1
> 3 subtract result of 1. to im1
> 4 subtraction the result of 2. to the result of 3.
> Fastidious and I think quite time consuming. Is there another, quicker
> way for doing such a thing, like a double threshold ?
> Thank you all,
> Best regards,
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing OpenCVfirstname.lastname@example.org