RadWebCam Zoom and Rotation

1 Answer 114 Views
WebCam
Tyler
Top achievements
Rank 1
Tyler asked on 22 Aug 2023, 08:23 PM

Hello,

I am developing an app for a Windows 10 Tablet that requires a picture to be taken.

I have set up a RadWebCam control, but when I open the settings menu on the tablet it takes 2-3 minutes of "Not Responding" before it loads the settings menu. Additionally it is very slow when adjusting the settings. The only reason I need the settings is for the Zoom control. Is it possible for me to change the zoom programmatically? I would like to add a +/- zoom button, but I cannot find anything on how to do this.

My second issue is that the app needs to run in portrait mode, but the camera is in horizontal mode. Is there any way I can change the rotation of the web cam? If I rotate the control it will rotate the bottom panel as well.

 

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 25 Aug 2023, 01:43 PM

Hello Tyler,

(1) We are not aware of any issues related to slow camera settings. I also tested this in our demos, but couldn't recreate anything similar. Can you send over a small sample project so I can test it on my side? Also, can you check the Output pane of your Visual Studio instance when this happens? It may contain some errors or another information that could tell us what is happening. 

As for setting the zoom level manually, I am afraid that this is not supported. The zooming API is internal and there is no proper way to access and use it. In this regard, I have logged a new feature request to allow this, and also updated your Telerik points.

(2) The camera control doesn't have an option to rotate the image. However, there is feature request to allow this. In the meantime, you can try your idea with rotating the control. If you want to rotate only the image, you can use the ChildrenOfType extension method to get only image host, but keep in mind this won't change the camera mode, but just rotate the image.

private void RadWebCam_Loaded(object sender, RoutedEventArgs e)
{
	var webCam = (RadWebCam) sender;
	var imageHost = webCam.ChildrenOfType<Image>().FirstOrDefault(x => x.Name == "PART_WebCamDisplay");
	if (imageHost != null)
	{
		imageHost.LayoutTransform = new RotateTransform(90);
	}
}

You can use a similar approach for a custom zooming implementation where you can try applying a ScaleTransform over the image element.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tyler
Top achievements
Rank 1
commented on 25 Aug 2023, 07:50 PM

Hi Martin,

 

Thank you for your response. I think the problem is the tablet is old and does not have a lot of processing power. Everything is working on my development machine, but when I deploy to the tablet it just cannot handle opening the settings. We are receiving new tablets soon that are a little bit faster so I will see how it runs with them before deciding which route to take.

Tags
WebCam
Asked by
Tyler
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or