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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

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

1 ACCEPTED SOLUTION

Accepted Solutions
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.

4 REPLIES 4
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.

4-Participant
(To:RichardJ)

thanks Richard - very neat!

Jason

1-Newbie
(To:Jbryant61)

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

1-Newbie
(To:ptc-5093000)

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