how do I only process part of the camera image in grip?

Hi

I’m using grip with Java.
How do I exclude the top portion of the camera image from being processed.

I can use GRIP or just add the code to the Vision processing loop by hand.

Thaaks for any help.

Phil

Disclaimer: I am not an expert in GRIP but in the image processing tab, there is a “mask” tool that allows you to apply a binary mask to filter out some areas of the image. Can’t you use that?

OK, I experimented with the MASK feature, and it appears that this does what I want.

I got it working in the GRIP app, but I’m unsure how to add it into my Java Project.

The new GRIP generated code has added an additional source argument into the process, which I assume is the mask image I generated… but how does this relate to my FRC Java project?

eg:
Does this image belong in my project? (seems to me that it should)
How do I pass the image to the vision processing process? file name???
How does the image mask get transferred over to the roboRio?

Seems like a lot of trouble to go to since all I want to do is ignore the top half of the view. :frowning:

However, If I can get it to work it does give me more flexibility to ignore other stray reflections…

Again, I am not an expert in GRIP but I am imagining you have created a binary mask file, correct? You can probably use some sort of FTP client (e.g. FileZilla FTC Client) and transfer the file to the RoboRIO in some folder (e.g. /home/lvuser/grip) Then in the grip created pipeline code, you should make it take two parameters:


public void process(Mat source0, Mat source1) {
    Mat maskInput = source0;
    Mat maskMask = source1;
    mask(maskInput, maskMask, maskOutput);
    ...
    ...

In your wrapper code that you call the process method, you need to load the mask file into a Mat (e.g. using imread() method of OpenCV) and pass it to the process method as the second parameter.
Disclaimer: I have never done this before so it is all from my imagination of how it should work.