Histogram equalization implementation [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
All resources that I have found a very different and I am not sure what I have to do.
Now I already got my histogram which was pretty straight forward, I also got my cumulative histogram
I don't know how I have to use this new histogram to get a better contrast in my image. It is a image from 0 to 255 -> black to white (Pseudo code would be enough)
I am not able to make this connection on my own.
ps: It's about the general idea.

High contrast images have gaps (zeros or near zeros), that appear on "left" and "right" (high and low) sides of histogram. Reduction of contrast can be achieved by remapping lightness values to a wider range.
Lets say on a histogram you have all values filled with 0 up until index=35 (histogram[35]) and then all 0 after index=200 (histogram[200]). Remapping of 35 to 0, and 200 to 255 and interpolation everything in between accordingly will reduce total image contrast.
To increase contrast, a reverse of the above should be applied, so that the histogram is "compressed" from low and high ends.

Related

Find the boundary of a polygon (or a staircase) c++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I'm doing an 2D bin packing algorithm. The goal is to put a set of rectangle into a bin one by one.
At each rectangle insertion, i want to update the boundary between occupied area and free area. Thus, i'm looking for an algorithm or the way to do it. Algorithm must be able to:
1) Find the boundary after rectangle insertion (or find all points of the boundary).
2) Travel clockwise all the points of the boundary (imagine that now I have all points coordinates of the boundary).
3) At each corner (point) of the boundary, the algorithm can determinate if this point is on the top left, top right, bottom left, bottom right
Any help would be greatly appreciated. If you need more information, just ask and I'll provide all I can.
Thank you
See these links:
http://en.wikipedia.org/wiki/Bin_packing_problem
How is 2D bin packing achieved programmatically?
https://math.stackexchange.com/questions/352575/2d-bin-packing-problem-with-opportunity-to-optimize-the-size-of-the-bin

Interpolation of Matrix in C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
May I know how can I do the interpolation for a matrix in C++?
Eg:
I have a 3x3 matrix
{0 0 0
0 1 1
0 0 1}
I wish to resize it to a 10x10 matrix using bilinear interpolation.
Any tips or references about this?
What you want to do is called image resizing using bilinear interpolation. Knowing that google is your friend. I would try using a C++ library for that purpose. This question covers all C++ imaging libraries: Fastest C/C++ image resizing library Any reasonable library should satisfy your needs.
In order to linearly interpolate between two things you need to embed (put) them in a common vector space and then "draw" the line between them.
I can't see a useful embedding of a 3x3 matrix and a 10x10 matrix in a common vector space...

Area of polygon using c++? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
How can i calculate the area of a polygon in c++ only by knowing the x and y coordonates of the points which make the polygon?
A simple google search shows the answer provided that you are dealing with non-self-intersecting polygons. The sign of the area is positive if the points on the polygon are arranged in counterclockwise order. This formula does not assume that the polygon is convex.
http://mathworld.wolfram.com/PolygonArea.html
Here, the area is found by summing the determinent of neighboring points. Each determinent computes the area of the parallelogram formed by the vector e.g. (x1,y1) and (x2,y2) (where both vectors stem from the origin (0,0)). The division by 2 gives the area of a triangle. When traveling around the polygon, the triangles will have a positive area if your polygon is convex. Otherwise, negative areas of these triangles will cancel with their positive counterparts for the case of a concave polygon giving you the correct result.
Simple wikipedia search shows the answer:
http://en.wikipedia.org/wiki/Polygon#Area_and_centroid

How to determine what bin a float should be in? C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have an array of floats Float_t xbins[41] that defines 40 bins i.e. ranges of floats.
E.g. y is in bin 7 if y > xbins[7] && !(y > xbins[8]).
How do I determine what bin a given float should belong to without having 40 if statements?
Please answer in C++ as I don't speak other languages.
If the array is sorted, then do a binary search to locate the correct bin. You'll need a combination of std::sort (if not sorted), then something like std::lower_bound, to locate. You'll need to ensure that operator< is implemented correctly for Float_t.
As it turned out that the bins are not uniformly spaced but have integer bounds, the probably fastest method is to have a (inverse) look up table that apparently has about 100 entries. One needs to make basically two comparisons for the lower & higher bounds.
If the array bounds are derived with a formula, it could be possible to write an inverse formula that outperforms the LUT method.
For a generic case binary search is the way -- and even that can be improved a bit by doing linear interpolation instead of exactly subdividing the range to half. The speed (if the data is not pathological) would be O(loglogn) compared to O(logn) for binary search.

Computing Rotation Speed In C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
Basically, In C++, how do I compute how long will it take for a car wheel to rotate 360 degrees while moving at a speed of 10 MPH? I've tried googling but nothing showed up. Any ideas?
As usual, I've searched this site for an answer but nothing showed up - unless I missed one.
Thanks.
If you know the speed of your object and the radius of the circle it moves on, then the time needed for one rotation is
rotation_time = 2*pi*radius/speed
The number of rotations per time unit is
rotation_speed = 1/rotation_time
The angular speed is
angular_speed = full_circle/rotation_time,
with the value of full_circle depending on your angular unit, e.g. 360 or 2*pi.