How to apply mask before tracking paticles

23 views
Skip to first unread message

Chris Xu

unread,
Feb 17, 2023, 4:56:02 AM2/17/23
to openptv
Dear community,

I want to apply a mask before tracking particles in openptv so it won't track particles in the grain areas but I am not sure how to do that. I saw the subtract mask option under "Main Parameters" but it asks for the base name for the mask (as shown below):
Main Parameters.PNG
Anyone can help me with how to use the subtract mask feature? I have attached the mask that needs to be applied below as well (the white areas are grain and the particles can only pass through the black areas).

Thanks in advance,
Chris
Mask.tif

Alex Liberzon

unread,
Feb 17, 2023, 5:13:47 AM2/17/23
to Chris Xu, openptv
please upload also the working folder with some images. especially if you use a multi-camera system we need to think how to implement 2-4 masks to 2-4 cameras 

i think at the moment the mask is not fully implemented, but it is not too long to complete 

Best regards
Alex 

From: ope...@googlegroups.com <ope...@googlegroups.com> on behalf of Chris Xu <chris...@gmail.com>
Sent: Friday, February 17, 2023 11:56:02 AM
To: openptv <ope...@googlegroups.com>
Subject: How to apply mask before tracking paticles
 
--
You received this message because you are subscribed to the Google Groups "openptv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openptv+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openptv/b98ff137-0405-4d11-8520-cff1b040700en%40googlegroups.com.

Alex Liberzon

unread,
Feb 17, 2023, 11:32:11 AM2/17/23
to openptv
meanwhile, I recommend using scikit-image outside of pyptv to create masked images

Alex Liberzon

unread,
Feb 17, 2023, 4:42:54 PM2/17/23
to openptv
Please update your pyptv version to 0.1.9

`pip install pyptv --upgrade`

or from git:

`pip install git+https://github.com/alexlib/pyptv --upgrade`


How to use masking: 

1. in the Main parameters GUI check the box `Subtract Mask`
2. add the base name in the form `mask_#.tif` or `img/<your_filename>_#.tif` where `#` is the camera number
3. store in the working folder the file per camera, i.e., mask_1.tif, mask_2.tif ... and so on

In the parameters, folder should appear JSON file - but only in the corresponding Run

Screenshot from 2023-02-17 23-40-23.png


An example of the working folder with the masking.json is on GitHub https://github.com/alexlib/openptv_test_case_fall2023  and you can try:

`python pyptv/pyptv_gui.py openpiv_test_case_fall2023`

Good luck



On Friday, February 17, 2023 at 6:32:11 PM UTC+2 Alex Liberzon wrote:
meanwhile, I recommend using scikit-image outside of pyptv to create masked images


On Friday, February 17, 2023 at 12:13:47 PM UTC+2 Alex Liberzon wrote:
please upload also the working folder with some images. especially if you use a multi-camera system we need to think how to implement 2-4 masks to 2-4 cameras 

i think at the moment the mask is not fully implemented, but it is not too long to complete 

Best regards
Alex 
From: ope...@googlegroups.com <ope...@googlegroups.com> on behalf of Chris Xu <chris...@gmail.com>
Sent: Friday, February 17, 2023 11:56:02 AM
To: openptv <ope...@googlegroups.com>
Subject: How to apply mask before tracking paticles
 
Reply all
Reply to author
Forward
0 new messages