Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Question: LineDetection in Video #199

Open
ReinhardGruber opened this issue Mar 31, 2021 · 3 comments
Open

Question: LineDetection in Video #199

ReinhardGruber opened this issue Mar 31, 2021 · 3 comments

Comments

@ReinhardGruber
Copy link

Is it possible to use the sobel line detection in video mode and display in preview?

@MV10
Copy link
Collaborator

MV10 commented Mar 31, 2021

I don't think that's possible at the moment. Effects and similar processing operates on the output of the hardware pipeline.

Last year I was trying to figure out how to do motion detection earlier in the pipeline (at the port level) and concluded it wasn't possible, but Ian speculated that it might be possible with changes. I'll take his word for it, he's the MMAL ninja around here. But right now only built-in features like the resizer work in the middle of the pipeline.

I was barely able to get video of the motion detection processor to work by piping the raw output through ffmpeg and clvc to an MJPEG stream (v0.7 wiki), but that's low resolution (640x480 is optimal) and even at low res the matrix effects run too slowly for real time video -- depending on matrix size you're doing 9X or even 25X the number of passes per pixel that motion detection is doing.

@ReinhardGruber
Copy link
Author

ok. is it possible to modify the preview stream frame by frame? (like the resizer)

Framerate: 1 frame per second is enough

@MV10
Copy link
Collaborator

MV10 commented Apr 15, 2021

No, that's what I was trying to explain -- image effects only operate on pipeline output, there's currently no way to feed any sort of complex (frame-level) processing back into the pipeline. The preview stream is part of the pipeline. With the current design, preview output can only be altered by built-in features (like the resizer).

(I say "complex" processing because there are places within the pipeline where very simple processing could alter the image, but the amount of data available can vary considerably and unpredictably, so I think only individual pixel-level effects are reasonable with the current design. Color filters, for example. Line detection is very complex, relatively speaking.)

As for framerate, if I remember right, a 3x3 matrix ran against lower resolutions at about 3 FPS. I would expect .NET 5.0 and later will run much more quickly, although I haven't had time to mess with it.

But unfortunately, I think the bottom line is that the library can't do this yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants