How to realize ROI (region of interest ) in EDSDK? - roi

I need to take picture with EDSDK and save to host only ROI of Image. Do I need to use EdsGetImage? How can I realize this? I don't understand how to use EdsGetImage.

EDSDK only provides complete, uncropped image download to Host in either JPG or CR2. You may crop once the original is downloaded and decoded. You might want to use EDSDKs internal EdsGetImage, with EdsRect and EdsSize parameters to do "cropped" retrieval from the image source.

Related

Extract image thumbnail from data

I'm using CGImageSource to read Exif (and other) data of image file. Some image files are embedded with their own thumbnail image (used for file icon).
I know I can extract a file icon using NSWorkspace.shared.icon(forFile:), but I'm already holding a CGImageSource ref, (and not sure of the cost of icon(forFile:) in performance).
Sure I can use the CGImageSourceCreateThumbnailAtIndex(.. to generate a thumbnail, but it would be more efficient to just fetch it (if it exists).
A 'you cannot do that' answer is also a good answer, (then I can go with plan B).

OpenLayers 3 BBOX strategy

Given this example http://openlayers.org/en/v3.0.0/examples/vector-wfs.js and using BBOX strategy , does it mean it is necessary to use &bbox=' + extent.join(',') part in source URL?
The OpenLayers3 Strategy BBOX strategy says “request new features
whenever the map bounds are outside the bounds of the previously
requested set of features.”
Yes, the &bbox=' + extent.join(',') if required. If you take it out, you will get no wfs features at all. The example is actually somewhat misleading, in that, it calls it a BBOX strategy, whereas in fact it is a createTile strategy, using the BBOX from each underlying tile, as the wfs BBOX. If you look internally at the source code for ol.source.ServerVector you will find a function loadFeatures that calls ol.loadingstrategy.createTile from ol.loadingstrategy which returns the required extents for each tile, which is then used for each wfs call. That is the extent that you see in the extent.join above.
Or to look at it another way, for every call to get an imagery tile, there is a corresponding call to a wfs tile -- which you can verify by looking in the network tab of your browser's dev tools. So, really, this is a tile BBOX strategy, not a view BBOX strategy.
I thoroughly recommend getting local debugging working for OL3 to understand what is going on. You can do that either by loading ol-debug.js, for a non-compressed version of the js, or by setting up a local server, see these instructions

Save image that has been segmented in matlab

I would like to know how can we save an image that has been segmented (using fuzzy c-means method) in MATLAB where the end product are images of each cluster group. I would like to save the images to use later.
I assume you just want to save an image, this should be independent on how you produces that.
If I understood correctly you just have to use the function
imwrite(M, filename)
Where M is the matrix containing your image data. You just need to do this for each matrix/image you have.
Then you can reload the image from filename using imread.
imread(filename)
Note that if you want to specify the format for imwrite and not obtain it via the filename extension, you just to add an additional parameter as follow:
imwrite(M, filename, format)

Saving JPEG metada using OpenCV

Is there any way I could save some JPEG metadata (like Exposure Time) using OpenCV 2.4.2?
Any help would be appreciated.
You can use VideoCapture properties to retrieve information from images (frames).
I use pyexiv2 to create exif tags and write the retrieved info to those images.

Automatically crop image after save in rails with predefined height, width, and (x , y) index

I am searching the way to automatically crop image after save of Image:
I came across a tedious problem when transforming html to image in rails.
My problem is when html is converted to image then extra background is also appended to image, which I don't need so trying to crop image after save callback through some code.
I need answer specific to the problem, any help will be appriciated.
Thanks In Advance
Friends I povided the solution to answer below but I need more efficient and effective than my provided solution.
1) I want to do in shorter lines
2) With little cost of croping
3) Efficient algo
I think the most proper way is to use ImageMagic , which has its own scripting language (or API ) . Take a look at this Railscast. It uses CarrierWawe , I don't think it would be a problem for you.
After saving image I called this method to crop image
def reprocess_final_image
image_file_url = Rails.root.to_s+'/public'+self.final_image.url(:original).split('?')[0]
img = Magick::Image.read(image_file_url).first
img.format = "PNG"
img.crop_resized!(240,200, Magick::NorthWestGravity)
img.write(image_file_url)
end
where Crop resized method have parameters
img.crop_resized!(width,height,Gravity)
Cloudinary provide an awesome service for this kind of thing. Easy peasy integration with Heroku too!

Resources