cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Image scaling using Histogram

Jbryant61
4-Participant

Image scaling using Histogram

I'm trying to auto scale an image by using the histogram of the image and scaling so that a user defined percentage (e.g. 98%) is contained within the scale limits.

Maybe my attempt isn't the best way, and it doesn't work if I want to include 98% of all the data.

Thanks for any help.

Jason

ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:Jbryant61)

You have a couple of problems.

First, mn and mx are defined incorrectly.

Second, you have one equation and two unknowns. There are an infinite number of possible values of a and b that would include a given percentage of the data. You need to decide how to split the excluded percentage between the top and bottom of the range (the most obvious being half each), and solve for a and b based on those excluded percentages.

The lower guess value needs to be changed too.

View solution in original post

4 REPLIES 4
RichardJ
19-Tanzanite
(To:Jbryant61)

You have a couple of problems.

First, mn and mx are defined incorrectly.

Second, you have one equation and two unknowns. There are an infinite number of possible values of a and b that would include a given percentage of the data. You need to decide how to split the excluded percentage between the top and bottom of the range (the most obvious being half each), and solve for a and b based on those excluded percentages.

The lower guess value needs to be changed too.

Jbryant61
4-Participant
(To:RichardJ)

thanks Richard - very neat!

Jason

hope you can get what you want in scaling images . you can try other way, say with an image app to help you.

Hi, zhang.

Thanks for your nice sharing. I am also testing about the related image scaling projects offered by another imaging SDK. So far so good. And I will try your sharing later. We can communicate about it after that.

Best regards,

Arron

Announcements

Top Tags