Inverting images with cv.jit objects
Dear all –
I am creating an installation where the user has a light source which controls certain parameters of synthesis – i have managed to track my light object using the cv.jit objects which works brilliantly, but was wondering if there is a way to invert an image on the x axis – the user will be looking at the position of the tracked light object on a screen, but currently when you move your hand to the right, the object moves to the left, which is rather confusing for the user. Is there a jit. object than inverts the x axis?
Also, with the cv.jit library, is there a way to track individual colours (such as pink or green) or do I always need to use the jit.rbg2luma object an convert to greyscale and follow the lightest object?
Can’t you just flip the video before cv.jit analyzes it? That’s how I solved a similar problem.
Yes – that’s what I’m after. Have just found and object jit.dimmap, I’m assuming that it will work with the jit.qt.grab object – so my patch will go jit.qt.grab -> jit.dimmap -> jit.rbg2luma -> cv.jit objects for object tracking. I will give it a try.
use jit.dimmap or jit.grabe srcrect attribute if you need it to be inverted also with CV.JIT.
As far as I know CV.jit works only with gray images. So you need to use jit.rgb2luma
I did a quick test .
To invert matrix is lees power consuming if you use srcrsct and dstrect attribute in grab object then jit.dimmap .
Maybe I’m not quite getting what you want to do, but why can’t you simply flip the tracking coordinates, rather than the whole image? It should be orders of magnitude more efficient to do so.
Dear all – thanks for all your input so far, I really appreciate it.
I have managed to use the jit.dimmap object to invert the image going into the cv.jit objects and it works well. Originally, I was going to show an image of the user so that’s why I wanted to invert the whole image, but my design has changed, so I now only need to show the tracked object e.i. the output of cv.jit.blobs.centroids.draw. Jean, I think your idea would be better on my cpu so will try it out. Is there a specific object that will flip the tracking objects, or can I still use the jit.dimmap within the cv.jit objects? Also, I am going to use the tracked object to control perameters in my patch, so I ideally want to be able to extract the xy information of the tracked object. I have tried to unpack this information, but with no success. Is there a way of getting the x and y information of my tracked object?
from CV.JIT outlet connect jit.iter then unpack object to get the numbers.
double click cv.jit.blobs.centroids.draw to see the structure.
Many thanks for all your help – it works great.