Image analysis (Object detection) on ongoing streaming video captured through ip camera

Hello @cruizba
I have one more question: I need to do image analysis on ongoing streaming video which is captured through ip camera.
usually I have to perform object detection
Is any documnentation there ?. I saw OpenVidu Docs but this is what I am not looking for.
If I have to add/perform openCV or Deeplearnig algorithm which part of the code should I modify is it on the browser side (openvidu-browser-2.19.0.js) or any hint regarding this would be appreciated.

@cruizba @CSantosM
May I request an hint for the above mentioned question ?

If you want to perform object detection in the server you have to implement a custom Kurento Module:

https://doc-kurento.readthedocs.io/en/stable/user/writing_modules.html

Then you have to create a custom Kurento Docker image with the module installed:

https://doc-kurento.readthedocs.io/en/stable/user/writing_modules.html#installing-in-docker

Finally you have to configure the session to use the module created:

https://docs.openvidu.io/en/2.19.0/advanced-features/filters/

Hope it helps.

Regards

I had created a sample kurento custom filter.
If I had to call the filter in ip camera running tutorial which part of the code should I tweak
As I see in link OpenVidu Docs
There is a snippet code

ConnectionProperties connectionProperties = new ConnectionProperties.Builder()
    .type(ConnectionType.WEBRTC)
    .data("user_data")
    .role(OpenViduRole.PUBLISHER)
    .kurentoOptions(
        new KurentoOptions.Builder()
            .allowedFilters(new String[]{"GStreamerFilter", "FaceOverlayFilter"})
            .build())
    .build();
Connection connection = session.createConnection(connectionProperties);
String token = connection.getToken();

So I call the filter name over here:
allowedFilters(new String[]{"GStreamerFilter", "FaceOverlayFilter"})

or how this gone work any hint or support would be appreciated
@micael.gallego @cruizba @CSantosM

You have to allow your own filter in “allowedFilters”.

Also, to connect a IP_CAMERA, the type should be type(ConnectionType.IPCAM)

Regards

Hello @micael.gallego
I am not able to run docker build inside the docker container kms
is it I need to install docker inside the container ??
or in this link Writing Kurento Modules — Kurento 6.16.0 documentation as said it’s not working
May I know what is the possible reason ??
Any hint is appreciated

Regards,

Hello @micael.gallego @cruizba @CSantosM
As said in above thread by @micael.gallego I have tweaked the lines from 70 in MyRestController.java
I don’t get that in place of type(ConnectionType.WEBRTC) I used type(ConnectionType.IPCAM)
and in allowedFilters(new String[]{“opencvsample”}) I had given my custom module filter

// Create a Connection for the client
		ConnectionProperties connectionProperties = new ConnectionProperties.Builder()
				.type(ConnectionType.IPCAM)
				.data("user_data")
				.role(OpenViduRole.SUBSCRIBER)
				.kurentoOptions(
					new KurentoOptions.Builder()
						.allowedFilters(new String[]{"opencvsample"})
						.build())
				.build();
		String token = null;
		try {
			token = this.session.createConnection(connectionProperties).getToken();
		} catch (OpenViduHttpException e)

When I run the application I get the error as Error creating Connection for session MySurveillanceSession: 400
But when I keep the type(ConnectionType.WEBRTC) I don’t see any errors and other hand I can’t see filter applied to video(captured from ip camera)

You don’t have to use docker build inside the container. You have to use docker build in your host to create a new kms image with your plugin.

Hello @micael.gallego @CSantosM @cruizba
this is filter that I had in kms used by openvidu

root@df5658176b0b:/# kurento-media-server -v
Kurento Media Server version: 6.16.0
Found modules:
        'chroma' version 6.16.0
        'core' version 6.16.0
        'elements' version 6.16.0
        'filters' version 6.16.0
        'opencvsample' version 0.0.1~0.g8fe867d
        'opencvtest' version 0.0.1~0.g5732698

Is this defined correct in openvidu-ipcamera tutorial ??
I had tweaked the MyRestController.Java file as shown below

// Create a Connection for the client
		ConnectionProperties connectionProperties = new ConnectionProperties.Builder()
				.type(ConnectionType.IPCAM)
				.role(OpenViduRole.SUBSCRIBER)
				.kurentoOptions(
					new KurentoOptions.Builder()
						.allowedFilters(new String[]{"opencvtest"})
						.build())
				.build();
		String token = null;
		try {
			token = this.session.createConnection(connectionProperties).getToken();
		} catch (OpenViduHttpException e) {
			if (e.getStatus() == 404) {
				// Session was closed in openvidu-server. Re-create it
				createOpenViduSession();
				publishCameras();
				token = this.session.createConnection(connectionProperties).getToken();
			} else {
				return generateError(model,
						"Error creating Connection for session " + SESSION_ID + ": " + e.getMessage());

And when I run this I get the following error:
Error creating Connection for session MySurveillanceSession: 400

Hi @Hrishkesh_Pattepu .

IP cameras are publishers, not subscribers. I think this is what is wrong in your code:

ConnectionProperties connectionProperties = new ConnectionProperties.Builder()
				.type(ConnectionType.IPCAM)
				.role(OpenViduRole.SUBSCRIBER)     <------ DELETE THIS
				.kurentoOptions(
					new KurentoOptions.Builder()
						.allowedFilters(new String[]{"opencvtest"})
						.build())
				.build();

Hello @cruizba
I had tried the way you said, I deleted

ConnectionProperties connectionProperties = new ConnectionProperties.Builder()
				.type(ConnectionType.IPCAM)
				.role(OpenViduRole.PUBLISHER)     <------ Replaced with publisher
				.kurentoOptions(
					new KurentoOptions.Builder()
						.allowedFilters(new String[]{"opencvtest"})
						.build())
				.build();

I get the following error
Error creating Connection for session MySurveillanceSession: 400
I know how to create custom module at lower level of kurento.
But not getting to know how to add my plugin at openvidu level
May I request for an help as said I’am new to this platform ??

Regards,

@Hrishkesh_Pattepu Let me do a couple of tests with some filters applied to IPCAMs, and I’ll come back with some more information.

Sure @pabloFuente, thank you so much!

I can confirm everything works just as expected when applying real-time filters over IPCAM streams. The only limitation is the following one:

You must control the application of the filter over the IPCAM stream through a MODERATOR connection. Audio/Video filters are managed via openvidu-browser.js library, just like this: OpenVidu Docs

But as IP cameras are Connections initialized through REST API (OpenVidu Docs), then the only way to apply and remove filters over its stream is through a different Connection (a regular one, of type WEBRTC), which will need role MODERATOR to do so over. Connections with role MODERATOR are the only ones able to apply filters over other Connection’s streams. To sum up:

  • Publish the IP camera stream through REST API just like this: OpenVidu Docs, making sure you provide the kurentoOptions.allowedFilters parameter.
  • Using openvidu-browser, and thanks to a Connection initialized with MODERATOR role, apply a video filter over the Stream object of the IP Camera participant (use this method: Stream | OpenVidu Browser - v2.19.0).

You should start receiving the IP Camera feed with the filter applied just after calling the previous openvidu-browser.js method.

Hello @pabloFuente
Thank you for the information provided
May I request for the example.
In your case if you had tested something can you share it ??
The points mentioned above looks confusing to me.

May I know what this phrase means ??
It would be better, If get some practical example on the below lines.
like what to add or which part of the code should I tweak ??

Hello @pabloFuente @micael.gallego @cruizba
May I request you to address the above question please ??

Hello @pabloFuente
May I request for example, where I can understand it much better.
It would be much helpful to me.

Regards,

We are going to publish a sample project soon.

Here you go: GitHub - pabloFuente/openvidu-filter-ipcam
That is a simple example based on tutorial openvidu-tutorials/openvidu-filters at master · OpenVidu/openvidu-tutorials · GitHub

It allows you to publish an IP camera and apply filters to it. See the README file for isntructions to run it.

Thank you so much @pabloFuente!!