kCVPixelBufferHeightKey and width not working - swift

Is there a way to set a custom AVCaptureVideoDataOutput for a desired output setting. What Im trying to achieve is below. However the buffer width and height never change .What Im trying to achieve is a custom height and a width for the video pixel output. What am I missing ?
AVCaptureVideoDataOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey: Int(kCVPixelFormatType_32BGRA),
kCVPixelBufferHeightKey: 300,
kCVPixelBufferWidthKey: 300] as [String : Any]
Thus, I tried with the same objective with the session preset, but they are not capable of setting a custom width and height. If I can get a 300x300 output thats a win

You won't get any change in video dimensions use Presets
if it doesn't fit your need use this NextLevelSessionExporter
to resize the video with or without aspect fit of the original record dimensions

Related

Add an image to the map and make sure aspect ratio is correct

I have tried adding an image to Leaflet using ImageOverlay, see for example the following code:
imageBounds = [[40.712216, -74.22655], [40.773941, -74.12544]];
var ol = L.imageOverlay(imageUrl, imageBounds).addTo(mymap);
Now the image is added, but I would like to use the aspect ratio of the image and I would prefer to actually set the image's center point instead of the bounds. Is this at all possible?
Size of the image is not that critical, lets say I want the width to be set to 60% of the current visible area of the map, I then want the height to be calculated so that the aspect ratio of the image is kept.
Problem is I am not sure I can just translate between latitude/longitude and x/y.
Is it correct to assume that the aspect ratio longitude/latitude is the same as for x/y if the map is quite zoomed in?
Is there an easier way to do this maybe?

Can I get a tableau view as an image in the size I want?

Let's say I have a Tableau view which I include via
http://tableau.MyViZ.com/MyWorkbookName/MyViewName
By viz.getUrl() + ".png" I can get an image of the view. However, that image does not have the size (resultion and probably aspect ratio) I want.
Can I call it in such a way that I can specify in which size I get it?
Just add ?:size=1000,400. The first number is the width, the second is the height.

Resizing command changes image shape

I have to resize image i.e if its dimension is 3456x5184 to 700X700 as my code needs image with less number of pixels otherwise it takes too much time to give results.So, when I use imresize command it changes the dimensions of image but at the same time it changes the shape of image i.e the circle in image which I also need to detect looks like oval instead of being cirle. I need your suggestions to resolve this problem. I am really grateful to you people.
Resizing images is done by either subsampling (to get smaller images) or some kind of interpolation (to get larger images)
Input is either a factor or a final dimension for width and height.
The only way to fit a rectangle into a square by simply resizing it is to use different scales for width and height. Which of course will yield in a distorted image.
To achieve what you want you can either crop a 700x700 region from your image or resize image using the same factor for with and height. Then you can fit the larger dimension into 700 and fill the rest around the other dimension with black or whatever you prefer.

How to get height and width of the object?

I have a project in which i need to get an object's height and width through camera.That is if we open the camera and look the object through camera then object's height and width will displayed in a text box.
can we do this or my idea is ambitious one ? Any help will be appreciated.
You could do that only if there is another metric available for you.
For example, user specified that size of particular object on the same picture is 1 meter. So by using simple geometry and math you could calculate other sizes. Without such information your problem could be resolved.

Maintain aspect ratio when converting video? - ffmpeg

I'm trying to convert movies from .avi to an iphone readable format
wherever I look, people suggest the following options for ffmpeg
ffmpeg -s 320x240 -aspect 320:240 [...]
This does not bode well for videos with a different aspect ratio!
How can I keep the aspect ratio from changing? Is there a way to set the size dynamically?
e.g. have the height to be 240 and the width variable?
Abstract from a rich article found here : http://www.frasq.org/en/transcoding-an-audio-or-a-video-file
To fit a video for a particular display, recompute its width and its height with the following formular:
aspect_ratio_of_display = width_of_display / height_of_display
aspect_ratio_of_video = width_of_video / height_of_video
if aspect_ratio_of_video > aspect_ratio_of_display
then
height = (height_of_video / aspect_ratio_of_video) and width = width_of_display
else
width = (height_of_display x aspect_ratio_of_video) and height = height_of_display
Remember to round the width and the height of the video to a multiple of 16.
Use a simple script in whatever language and get the video details, and adjust accordingly for a target size, you can also "letter box" or pad the top and bottoms for a better aspect ratio.
http://ubuntuforums.org/showthread.php?t=702188
http://stream0.org/2008/01/find-and-extract-video-file-de.html
http://www.mythtv.org/wiki/Ipod_export