Stretch camera in Smart Client multiwindow command

When creating a layout and triggering a multiview command, is it possible to set the cameras to stretch to the size of the view items? I know there is an option in the smart client to do this for individual view items e.g. stretch a 4:3 image to accommodate a 16:9 layout. Client is frustrasted with the black bars on either side…

I do not think this has to do with the development you made, but with setup in the Smart Client. You can for any camera view item go into setup choose whether to use “Maintain image aspect ratio” or not.

Hi Bo thanks,

I am going to try to set that to “true” in the properties of the viewItem to see if it works.

I need to be able to do it programatically because my viewlayouts are temporary.

That did not work, I will try to make a viewItemPlugin for what I need. Do you know if I can stretch the image with the workspaceviewitem2 example?

Hi, did you manage to solve this issue?

Do you have an example?

It must boil down to the ImageViewerControl (or ImageViewerWpfControl) usage -

--

virtual bool VideoOS.Platform.Client.ImageViewerControl.MaintainImageAspectRatio

[get, set]

-

Flag to instruct the presentation of the video to be displayed with the original aspect ratio (Default), or to fill the entire viewable area.

-–

http://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_client_1_1_image_viewer_control.html&tree=tree_search.html?search=imageviewercontrol

Hi,

Is it possible to provide an example of how to achieve this?

So automatically setting the ​maintain aspect ratio to false for every viewitem.

Thanks​

Hi Kenny,

Sure:

When you create your own custom view item (check the workspaceviewitem2 example), you can set the MaintainImageAspectRatio to “True”.

private void FillCameraSelection()
        {            
            if (_selectedCameraItem != null)
            {
                //button1.Text = _selectedCameraItem.Name;
                imageViewerControl.CameraFQID = _selectedCameraItem.FQID;
                //OnLiveTickChanged(this, null);
                imageViewerControl.EnableVisibleLiveIndicator = true;            
                imageViewerControl.EnableLiveStreamInformation = false;
                //imageViewerControl.EnableRecordedImageDisplayedEvent = true;
                imageViewerControl.EnableMouseControlledPtz = true;
                imageViewerControl.EnableMousePtzEmbeddedHandler = false;
                imageViewerControl.EnableDigitalZoom = false;
                imageViewerControl.MaintainImageAspectRatio = false;
                imageViewerControl.Initialize();
                imageViewerControl.Connect();
                imageViewerControl.Selected = true;
                imageViewerControl.PlaybackControllerFQID = null;                
            }
        }

Hi Eric,

Thanks for your answer.

I checked the example and I don’t seem to find a clear solution to my problem.

In fact I want to achieve that every time a camera is showed on to a imageViewerControl, the imageViewerControl.MaintainImageAspectRatio is set to false.

So also when a user creates a new view or drags a camera into an empty imageViewerControl or when a video wall shows a certain preset, so in fact : always. You can also see this as inverting Milestone’s default setting MaintainImageAspectRatio from true to false.

How can I achieve this?

Thanks again!

Hi Kenny,

Yeah I see what you mean, too bad that’s not a Smart Client profile option in the management client hint hint → anyone from Milestone reading this?

I had a client ask for this once to get images appear full screen and fill the view item (because that’s how it was before and now they just don’t like the feel of it, even though everyone in the images is stretched and looks funny).

What I did to do this was very complicated (Unfortunately I can’t share any code):

Register to the NewImageViewerControl event:

ClientControl.Instance.NewImageViewerControlEvent += new ClientControl.NewImageViewerControlHandler(NewImageViewerControlEvent);

Get Guid of new camera:

ImageViewerAddOn.CameraFQID.objectId

Replace the new standard camera view item with a custom MIP view item:

-> this is the hard part, you need to create a view item plugin that pulls up the same camera as soon as it detects that a new camera has appeared. This is the only way I know to set the maintain aspect ration to true but perhaps Milestone knows of a way to modify the Smart Client xml files to do this by default?

Anyways, To get it working, you will have to do this:

  1. Create a ViewItemPlugin inherited from the ViewItemUserControl class that has maintain image aspect ratio set to true.
  2. Register to the NewImageViewerControlEvent
  3. Detect when a standard Milestone image viewer control appears
void NewImageViewerControlEvent(ImageViewerAddOn imageViewerAddOn)
{
            //Util.Log(imageViewerAddOn.ImageViewerType.ToString());
            if (imageViewerAddOn.ImageViewerType == VideoOS.Platform.Client.ImageViewerType.CameraViewItem){
//you know it's a normal view item
        }
}

4. Remove the view item from the view at that specific view position

5. Insert your own “FullViewItem” as the position (index) where the old one was.

6. Hope that it works because you will probably need a day to code it.

Of course I have no idea how this will react with Smart Client or playback.

Fair warning, I tried to do this before but I had stability issues. We ended up telling the client that the image aspect ration should be maintained because some things like text could be harder to read if they are stretched.

Perhaps you will have more luck. I hope Milestone can give you a better solution.

Kind regards,

Eric Bourque

You will have to create your views or modify your views to use the not use “maintain image aspect ratio”.

The use of “maintain image aspect ratio” is default and this default cannot be changed, not through setup or MIP SDK.

The Smart Wall will use “maintain image aspect ratio” and this cannot be changed.

When you modify an existing view in setup note that there is an “Apply to all” button so that you can in one click share the setting with the rest of the camera view items in the view.