Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8088481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:06:13+00:00 2026-06-05T19:06:13+00:00

So I have this bit of code for x in range(x1,x2): for y in

  • 0

So I have this bit of code

for x in range(x1,x2):
        for y in range(y1, y2):
            cpixel = pixels[x, y]
            if bw:
                bw_value = int(round(sum(cpixel) / float(len(cpixel))))
                all_pixels.append(bw_value)
                title = "Averaged (B&W) Pixel Values"
            else:
                if lumi:
                    luma = (0.3 * cpixel[0]) + (0.59 * cpixel[1]) + (0.11 * cpixel[2])
                    all_pixels.append(luma)
                    title = "Pixel Luminosity Values"
                else:
                    if round(sum(cpixel)) / float(len(cpixel)) > 100:
                        all_pixels.append(255)
                    else:
                        all_pixels.append(0)
                    title = "Pixel Binary Transform Values"

taken and modified a bit from here Getting list of pixel values from PIL to give a list of pixel values (all_pixels) within a bounding region (user selected).

I’m trying to figure out an efficient way to detect changes within the list after a series of similar values have been recorded. Since the list seems to list the pixel values from top to bottom and left to right. In the scenario I will be using it in, it’ll have a list of similar values until it hits a region of an image where the values will then begin to switch back and forth until the values once again stabilize around a new value.

What I’m interested in is tracking the boundary between these two, I want to detect where this boundary is and if it shifts left or right. I can’t really think of any other way than having to check each value as it’s appended to all_pixels and then just tracing back the coordinates.

But even this seems rather sketchy since even if I set an arbitrary number of values to be the same before the next one that’s significantly different is seen as a significant change, not just an outlier, after that the values begin to toggle between the old values and the new ones.

I guess ideally I’d need to generate some sort of best fit line for the coordinates of this boundary region/line. I just need some ideas how to approach this problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:06:15+00:00Added an answer on June 5, 2026 at 7:06 pm

    Based on the description of the problem in your comment, I think a simple edge detector might suffice, although that would depend on things like the camera angle, contrast, lighting, etc.

    You could take the vertical derivative of the image, possibly smooth that a bit and find the row with the highest values. Assuming that the image is zoomed in on the cylinder with no other major vertical contrasts other than the powder boundary, that should be the height of the powder.

    You could code this yourself, or use OpenCV, but I think that might be a bit overpowered for this task. Numpy would also be a good option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this bit of code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data;
i have this bit of code, it limits the Li's to 15 of them
I have this bit of code, public static List<string> GetSentencesFromWords(List<string> words, string fileContents) {
ok i got this problem. i have this routes: (code bit change) File:/home/dotcloud/current/config/routes.js exports.routes
I use this bit of code to feed some data i have parsed from
its a little bit hard to understand. in the header.php i have this code:
I have the following bit of code, simply: $(function() { $('a.add-photos-link').live('click', function(e) { $(this).colorbox({
I have a bit of php code like this: $test = <!--my comment goes
I have a bit of sample code that is throwing this warning: main.c: In
I have this bit of code I found on the web at the end

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.