Using a TreeMap with images - image

For representing most popular artists from EchoNest API, I've been trying to set-up Silverlight Toolkit's TreeMap using images, their TreeItemDefinition.ValueBinding being defined as the area of the image.
While it mostly fills up the space when the image stretch is set to 'Fill' :
When setting image stretch to 'Uniform' a lot of blank spaces remain :
On this post, image carving is suggested : Treemapping with a given aspect ratio
How can I know which images should be carved and at what dimensions they should be carved if possible at all ?
Is this problem solvable without human intervention for a good result ?

I don't think there is a way to know which images should be carved and at what dimensions they should be carved. An ok-ish euristic might be to check if the mean energy of an image is > a certain threshold (this can be refined to check only blocks of every image, and combining the result later: if the image has blocks without details/energy, it can be carved, at least in that section).
What i think would be better is to apply seam carving to the already composed image: that will try to carve out the white outlines (adding "artificial" energy to the patches of images might lead to even better results, preserving more the shapes of each image). This paper might be of use to check out other image resizing methods too.

Related

Tensorflow object detection training

I would like to detect objects (upper half of the image below) in images (bottom half). Is it smart to train the dataset with images in a different scale (or size)? Or shall I train it with parts of the bottom half of the image below? What is the best way to mark the objects for training?
Kind regards
If I understand your question correctly. If you are exclusively interested in detecting objects at roughly the scale of the below picture, your training data should consist of images like the below one. To add on: try to get at least a decent range of sizes around the bottom so as to avoid small deviations from a specific scale throwing it off, but generally you should be fine.

Would it be effective to crop image in yolo v4?

Example Image
For example as Image above, area I need is just like red box, and other section doesn't have any labels for classification/object detection.
What I think is "If I use cropped image to red box will occur better effect" because there's to much useless area without labels in original image. When mosaic augmentation used in yolo v4, It will put images together in one. And, because there's so many area without labels, data after mosaic can be useless than before.
But, This is just my guess, and I need a test to confirm it, but the lack of computing power is limiting the actual test. So the question is, Is it possible to actually improve performance if the original image is cropped in the form of a red box? Is that why I guessed correctly?
Also, my partner said that cropping is not a good choice in Yolo because it can ruin the proportion of the object, but I couldn't understand what the proportion of the object meant in Yolo. I wonder why the proportion of objects in Yolo is not suit with cropping.
Thanks for read, and have a nice day
simply you shouldn't resize the images, however, if the training/testing data set contains considerable difference among width and heights, use the data augmentation methods. Pls, follow the link for more information.
https://github.com/pjreddie/darknet/issues/800

layout algorithm for tightly-packed image thumbnails

I'm working on an image gallery and I'd like to tightly pack the image thumbnails. The thumbnails are:
different aspect ratios
available at the same source resolution (longest edge 256 pixels)
I'd like to come up with an optimal solution (will probably have to be a heuristic) that allowed me to balance:
the padding between each thumbnail (preferably constant)
the consistency of thumbnail size (preferably all the same size)
the amount of each image that gets cropped for the display (preferably none)
the proximity of images consistent with their sort order (preferably sort-neighbours will be near one another in the grid)
I think this is a variant of the rectangle packing problem.
I've found some good references: Fast Optimizing Rectangle Packing Algorithm for Building CSS Sprites
But I wanted to check with the experts to see if anyone knows of:
any established algorithms that are available publicly,
any open source libraries that implement them or
any other mathematical references or guidance that might help me produce something as good as: http://labs.tineye.com/multicolr#colors=4b669e;weights=100;
I have come up with something like this (now also with code on github)
https://mendrik.github.io/diorama/
I should add that the order will be random, and the sizes try to be uniform, but for me it was more important to fill out the entire space rather than keep the sizes consistent. You can resize the browser window to see how it works.
If your height is not fixed, there are several other options, mostly knapsack or partitioning algorithms. 2d bin backing will leave you with gaps or wont find solutions that always fit all images.
my algorithm has almost no cropping and fits always all images into the given space, provided there are enough combinations to do so. the less images the more cropping obviously.

Averaging images sequentially

I realize there might be a better place to ask this, but I think you all will have some valuable feedback.
People are asked to draw a shape in black on a white cavas. Then their drawing is added to the running average. I'd like to have the parts that the images mostly have in common be shown, and the parts of the drawing that are unlike most of the other drawings disappear.
My two problems are that I'm using ImageMagick to process the images, which means that I can only create a composite of two images at once. So I have the running total image, and the newest one to add. I cannot get a real average this way.
Secondly, I do not fully understand blending modes particularly when different opacities are involved. I'm not sure which is the best to use.
When you add the first two images you blend them equally. But then when you add the 3rd image to the mix you have to change the weight of each image. The two image composite should be blended at 66.6% while the new image should contribute just 33.3%. For the 4th image you will blend at 75% and 25% respectively. In general, if you have n images in the composite, then the new image should contribute 100/(n+1) percent when added.
As you see, the more images you have the less an individual image affects the composite result.

How can I deblur an image in matlab?

I need to remove the blur this image:
Image source: http://www.flickr.com/photos/63036721#N02/5733034767/
Any Ideas?
Although previous answers are right when they say that you can't recover lost information, you could investigate a little and make a few guesses.
I downloaded your image in what seems to be the original size (75x75) and you can see here a zoomed segment (one little square = one pixel)
It seems a pretty linear grayscale! Let's verify it by plotting the intensities of the central row. In Mathematica:
ListLinePlot[First /# ImageData[i][[38]][[1 ;; 15]]]
So, it is effectively linear, starting at zero and ending at one.
So you may guess it was originally a B&W image, linearly blurred.
The easiest way to deblur that (not always giving good results, but enough in your case) is to binarize the image with a 0.5 threshold. Like this:
And this is a possible way. Just remember we are guessing a lot here!
HTH!
You cannot generally retrieve missing information.
If you know what it is an image of, in this case a Gaussian or Airy profile then it's probably an out of focus image of a point source - you can determine the characteristics of the point.
Another technique is to try and determine the character tics of the blurring - especially if you have many images form the same blurred system. Then iteratively create a possible source image, blur it by that convolution and compare it to the blurred image.
This is the general technique used to make radio astronomy source maps (images) and was used for the flawed Hubble Space Telescope images
When working with images one of the most common things is to use a convolution filter. There is a "sharpen" filter that does what it can to remove blur from an image. An example of a sharpen filter can be found here:
http://www.panoramafactory.com/sharpness/sharpness.html
Some programs like matlab make convolution really easy: conv2(A,B)
And most nice photo editing have the filters under some name or another (sharpen usually).
But keep in mind that filters can only do so much. In theory, the actual information has been lost by the blurring process and it is impossible to perfectly reconstruct the initial image (no matter what TV will lead you to believe).
In this case it seems like you have a very simple image with only black and white. Knowing this about your image you could always use a simple threshold. Set everything above a certain threshold to white, and everything below to black. Once again most photo editing software makes this really easy.
You cannot retrieve missing information, but under certain assumptions you can sharpen.
Try unsharp masking.

Resources