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

Utilize numpy functions to do the color correction #8

Merged
merged 1 commit into from
Feb 16, 2021

Conversation

manipopopo
Copy link
Contributor

@manipopopo manipopopo commented Feb 14, 2021

The PR utilizes broadcasting mechanism and numpy functions to speed up the color correction.

On a machine with 8-core 3.1 Ghz CPU, the original correctImage takes ~1.88 second to process example_images/figure3.jpg. With the PR, it takes ~0.14 second to process the same image.

See also #5 and #6.

Copy link
Owner

@mahmoudnafifi mahmoudnafifi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks .. approved.

I[:, 1] * I[:, 2], I[:, 0] * I[:, 0], I[:, 1] * I[:, 1],
I[:, 2] * I[:, 2], I[:, 0] * I[:, 1] * I[:, 2],
np.repeat(1, np.shape(I)[0]))))
rgb = I
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may need to change kernelP(I) to kernelP(rgb)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can apply the change in other commits so that the PR won't introduced backward incompatible changes. The users might call the public function kernelP with keyword argument KernelP(I=some_rgb_image).

@mahmoudnafifi mahmoudnafifi merged commit 75883e4 into mahmoudnafifi:master Feb 16, 2021
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

Successfully merging this pull request may close these issues.

2 participants