Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image.Crop() #5

Open
swharden opened this issue Sep 14, 2022 · 1 comment
Open

Image.Crop() #5

swharden opened this issue Sep 14, 2022 · 1 comment

Comments

@swharden
Copy link
Owner

useful for getting stats from rectangular ROIs

@swharden
Copy link
Owner Author

I'm using this for now

public static double RoiMean(this SciTIF.Image img, int x1, int x2, int y1, int y2)
{
    double sum = 0;
    int pixels = (x2 - x1 + 1) * (y2 - y1 + 1);

    for (int x = x1; x <= x2; x++)
    {
        for (int y = y1; y <= y2; y++)
        {
            sum += img.GetPixel(x, y);
        }
    }

    return sum / pixels;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant