Ask Your Question
1

how to calculate VARI using open cv ?

asked 2020-08-23 09:58:05 -0600

hasnan gravatar image

updated 2020-08-23 10:04:14 -0600

I try to calculate VARI (false-NDVI) in visual studio and coding like below but the result is not what I want

split(img, chanel); //split rgb to 3 bands
Mat vari = (chanel[1] - chanel[2]) / (chanel[1] + chanel[2] - chanel[0]);
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2020-08-23 11:09:12 -0600

berak gravatar image

updated 2020-08-23 11:09:49 -0600

you cannot do this operation in uchar space

(e.g. divisions will lead to values < 1), you should convert to some float:

img.convertTo(img, CV_32F);

before splitting it.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-08-23 09:58:05 -0600

Seen: 140 times

Last updated: Aug 23 '20