Get wrong profile picture size - facebook-graph-api

Why do I receive an image of 160*160 when i ask for an image of 99*67 with https://graph.facebook.com/552985295/picture?width=99&height=67

160x160 is default or nearest, when given resolution is not supported

Related

Blurry Saved Images of Detected Objects using OpenCV

I have a c++ code that is being run on the Parrot AR.Drone version 2.0 to detect objects, then save images of the detected objects to the controller (computer). As you all may know, the AR.Drone has an 720p High Definition camera. However, the saved images are very blurry. I cannot seem to find any OpenCV function that increases the resolution of the saved images, however I believe the resolution is set to 95/100 by default for OpenCV. Does anyone know of any solution to this problem?
Any input or comment would be helpful.
I think you mean 95/100 of jPEG quality. You can change the third parameter of cv::imwrite like it said in the opencv documentation
cv::imwrite("name.jpg", image, CV_IMWRITE_JPEG_QUALITY=100); //100 instead of default 95
But this method only increase the quality, not the resolution... and there shouldn't be much difference between 95 and 100%.

Fine-uploader - Scaling picture by height

I read the documentation about scaling with Fine Uploader:
http://docs.fineuploader.com/features/scaling.html
Is possible to scale a picture just considering the height of a picture?
For example we need to resize a picture in order that will be not taller than 1080 px.
If a picture dimensions are 1200x800, I want the it will be NOT scaled because the height is already less than 1080 px.
But with a picture that is 800x1200 I want that will be scaled based on the height of 1080 px.
Is it possible?
I'm not seeing anything in the API in order to do it.
You can generate a scaled version of an image on-demand with varying restrictions programmatically via Fine Uploader's scaleImage API method. This will generate a Blob, which you can pass to the addBlobs API method.
If this proves to be cumbersome for your use case, and would like to see the ability to dynamically change scaling options per-file for internally scaled imags, please open up an issue in Fine Uploader's issue tracker.

cv::Mat detect PixelFormat

I'm trying to use pictureBox->Image (Windows Forms) to display a cv::Mat image (openCV). I want to do that without saving the Image as a file ('cause i want to reset the image every 100ms).
I just found that topic here: How to display a cv::Mat in a Windows Form application?
When i use this solution the image appears to be white only. I guess i took the wrong PixelFormat.
So how do figure out the PixelFormat i need? Haven't seen any Method in cv::Mat to get info about that. Or does this depend on the image Source i use to create this cv::Mat?
Thanks so far :)
Here i took a screen. Its not completely white. So i guess there is some color info. But maybe i'm wrong.
Screen
cv::Mat.depth() returns the pixel type, eg. CV_8U for 8bit unsigned etc.
and cv::Mat.channels() returns the number of channels, typically 3 for a colour image
For 'regular images' opencv generally uses 8bit BGR colour order which should map directly onto a Windows bitmap or most Windows libs.
SO you probably want system.drawing.imaging.pixelformat.Format24bppRgb, I don't know what order ( RGB or BGR) it uses but you can use the opencv cv::cvtColor() with CV_BGR2RGB to convert to RGB
Thanks for the help! The problem was something else.
I just did not allocate memory for the Image Object. So there was nothing to really display.
Using cv::Mat img; in the headerFile and img = new cv::Mat(120,160,0); in Constructor (ocvcamimg Class) got it to work. (ocvcamimg->captureCamMatImg() returns img).

How to convert photos to Polaroid-like programmatically?

How to convert modern day photos to the look and feel of those Polaroid photos ? References and/or sample codes are welcome. Thanks!
Convert the images to HSV (cv::cvtColor) then look at adjusting the hue/saturation values
see http://en.wikipedia.org/wiki/HSL_and_HSV for a rather too technical article
Here is a video showing how to do it in GIMP: http://www.youtube.com/watch?v=1LAUm-SrWJA and here is the tutorial: http://howto.nicubunu.ro/gimp_polaroid_photo/
You can look at various steps (each one of them would be some basic image processing operation) and glue together to make your own code. I think each GIMP operation is in turn available as a script-fu script/code.
I would suggest using blend modes along with the HSV conversion.
This website below has been of tremendous help to me while processing images to give them an 'old' look.
http://www.simplefilter.de/en/basics/mixmods.html
Do note that you need to mix and match different blend modes with color tints and blur algorithms to achieve the various Polaroid effects.
A good starting point would be look at ImagemMagick. It already does have cmdline options to change the hue and saturation of a photo. Find a parameter set that gives you the result that you want and look at the source code to see what it is doing behind the scenes..
Programmatically, you'd want to use an image processing library such as OpenCV.
A large part of the effect (besides adding the white frame) is a change in the image color balance and histogram. This is due to the degradation of the chemical elements in the Polaroid film.
The types of operations you would need to apply to the image:
Changing color spaces such as HSV;
Desaturation;
Blending with color filters (this is the suggested way here);
Changing the brightness and contrast of the image channels for the chosen color space.
Obviously, most tutorials about how to do this in Photoshop (or other photo editing apps), can be converted into programs using OpenCV.

Computing BITMAPINFOHEADER biCompression value for monochrome BMP

Hopefully someone has an answer, and it's not TOO complex. I'm working on a C++ dll (no C# or .Net, fully static DLL).
Anyhow, its woring on buildin monochrome bitmaps. I have all of it working EXCEPT the resolution. I get the Device Context, Get Compatible Device Context, build bitmap, draw what I need to (as black/white), and can save. All this works fine. However, I can't figure out how to set the resolution of the bitmap.
While doing some testing from another utility under C#, I can create a bitmap and set the resolution. In doing so, I ran a routine to generate the same file content with a parameter from 1 to 300 for the resolution. Each image came out exactly the same EXCEPT for the values in the "biCompression" DWORD property. The default is the screen resolution of 96x96, but need to obviously change for printers of 300x300, and even some at 203x203 resolution.
Are you absolutely sure? The description of the behavior you observe sounds fishy to me and I would suspect the code that you're using to write your bitmaps or your code that reads them back in.
Are you sure you don't want to set biXPelsPerMeter and biYPelsPerMeter? Those two fields tell you how many pixels per meter in X and Y, which you can use to set the DPI. biCompression only deals with the compression type of the bitmap, e.g., RLE, JPG, PNG, etc.
Thanks for input, but I'll look into the biXPelsPerMeter an biYPels... too. I'll double check the format, and what was set... if so, you may have hit it with a second set of eyes (minds) on my issue.
Thanks