Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box and centroid video has wrong format for inverted colours #9

Open
alexarje opened this issue Feb 26, 2020 · 14 comments
Open

Box and centroid video has wrong format for inverted colours #9

alexarje opened this issue Feb 26, 2020 · 14 comments
Labels
bug Something isn't working possibly fixed This issue is probably fixed, but needs some more testing until we can be 100% sure

Comments

@alexarje
Copy link

When exporting with inverse colours the box video and centroid videos have the wrong format. Looks like they only take up a small part on the left of the screen:

Screen Shot 2020-02-26 at 11 12 17

@alexarje alexarje added the bug Something isn't working label Feb 26, 2020
@alexarje
Copy link
Author

This also goes for the motion video exported when using inverted.

@alexarje alexarje added this to the New builds milestone Feb 26, 2020
@aleksati
Copy link

Might have something to do with the [jit. @op absdiff] stuff we added at the very end to the [VA_motion_image] and/or [mgt.toggle.rgb2luma2absdiff] , @balintlaczko . It makes sense that these would affect the motion image, box and centroid processing.

@alexarje
Copy link
Author

Looks more like stitching together several images with jit.glue or something like that? But it is only for the inverted video. And it looks nice in the preview.

@balintlaczko
Copy link

O-o, that doesn't look good. I have never seen it before though. Yes, it could be the last minute change, which was not tested so thoroughly, but this seems to be a problem with dims and not colors, and that change was (or at least meant to be) a simple color op. Seems like something unintended happens when we switch to inverted colors.

@balintlaczko balintlaczko self-assigned this Feb 27, 2020
@balintlaczko
Copy link

balintlaczko commented Feb 27, 2020

So far I could not manage to reproduce this problem on Windows. Things I have tried include:

  • opening the app/patch, drag&drop dance.avi, check inverted colors, and all three video export checkboxes in the menu, then hit Export. (to rule out init problems with cropping which used to be a thing, but quite a while ago)
  • cropping and not cropping
  • skipping and not skipping
  • trimming and not trimming

Outputs were as expected each time. Real-time preview also looked OK. Did discover however the "burn-in" of the centroid snake, so opened #28.

@alexarje, can you give some info about what you did when the issue happened?

@balintlaczko
Copy link

@AleksanderTidemann can you try reproducing this? Maybe it is an OSX thing? I couldn't manage to get it...

@aleksati
Copy link

aleksati commented Feb 28, 2020

First off, @balintlaczko , I´m experiencing that the same Bbox threshold generates very different videos when switching from inverted to normal colors in realtime. Like this:

ezgif com-video-to-gif
(notice the Bbox display)

I will do some more testing with export.

@aleksati
Copy link

Different but related bug can be seen here with the bbox:

ezgif com-resize

So it seems that the scaling (or the "bbox-cropping") depends on the color of the image to a considerable amount. I guess this is kind of related to issue #30 , both dealing with problems with inverted videos.

@aleksati
Copy link

aleksati commented Feb 28, 2020

My experience is that all of the exported videos correspond to the behavior in the Bbox Display, except for "movie.mp4" in the test_videos folder. This could be related to what I experience in issue #20 , that there are some videos that produce strange behavior in the app.

I tested the inverted dance.mp4 with skipping and trimming in:

  • Max with h624 .mp4
  • Max with JPEG .mov
  • Build with h624 .mp4
  • Build with JPEF .mov

In all of these, I was able to reproduce this exact same behavior: (The gif shows how the movie is in realtime, versus the exported version of the same video)

ezgif com-video-to-gif
Note: the flickering in the exported video shown is much more intense in real-life but is tuned down by the framerate of the gif.

So the answer is No, I have not yet been able to reproduce what Alexander experienced but did uncover strange behavior with specific videos (f.instance dance.mp4) and Bbox processing when switching from normal to inverted colors.

@balintlaczko
Copy link

What Alexander experienced is clearly an inappropriate dim problem, the image is squeezed horizontally.
Otherwise, regarding the box image, both the change in behavior due to the color flip and the flickering is normal, if we strictly look at the process behind it. None of that is a bug. If we want to get rid of the flickering I have two suggestions:

  • allow the user to use the radius parameter of [cv.jit.threshold] too, not just threshold. For example in Alekander's above example, the flickering is caused by some reflection/something not being filtered out by [cv.jit.threshold] because our default radius is 40 pixels, which is quite big, actually. If the radius is around 20, it gets filtered out consistently.
  • allow the user to optionally smooth the values returned by [jit.findbounds]. In the above example even if the radius is still the default 40, if I use some [slide] objects to lowpass filter the point coordinate values from [jit.findbounds], it won't be able to jump so big distances back and forth between consecutive frames.

I guess this should be an enhancement for the "more functionality" milestone, I will make an issue for that in a moment.
The original problem is still a question mark.

@balintlaczko balintlaczko removed their assignment Feb 29, 2020
@aleksati
Copy link

Good point! Sounds like an enhancement for the next version, yes.

balintlaczko added a commit that referenced this issue Feb 29, 2020
@balintlaczko
Copy link

I think I finally reproduced the bug, though a bit accidentally while working on another issue. It was something about the greyscale option and changing the matrices' planecount. It was pretty consistent, I could manage to reproduce it several times in a row with the exact same results. (I think I was going from greyscale to non-greyscale and inverted -> render to do it, but not sure...) Also noticed a warning in the help file for [jit.record] that it only handles 4-plane matrices. So I added a conversion to 4-plane before the record (if needed) in [mgt.write-to-file] and the problem disappeared, I think that was it. But let's test some more on both platforms, and if we really don't see it again in a long time we can close this...

@balintlaczko balintlaczko added the possibly fixed This issue is probably fixed, but needs some more testing until we can be 100% sure label Feb 29, 2020
@alexarje
Copy link
Author

Cool that you found it. I have my macbook in the office, and can test on Monday.

@aleksati
Copy link

aleksati commented Mar 1, 2020

Woo, nice catch! That makes sense actually, that there could be issues with going from 1 to more planes in an export scenario. We had similar issues in other places.

@alexarje alexarje removed this from the New v2 builds milestone Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working possibly fixed This issue is probably fixed, but needs some more testing until we can be 100% sure
Projects
None yet
Development

No branches or pull requests

3 participants