Hey guys! I'm performing the 3D histogram of RGB image my teacher said me there is a simple and faster way to do all what I'm doing with my code. But I do not find any reference that help me to achieve that.
I want to obtain the image attached. Does anyone knows how?
I just don't see how hist3 can do it. Despite it's poor choice of a name (in my opinion), it's really a 2D histogram, not a 3D histogram because there are only 2 independent variables. Try my color gamut visualizer program, attached way below, below all the images.
It's a primitive MATLAB version of the really nice one that is an ImageJ plugin.
Hi, I have just a question related to your "color_gamut_visualizer" function in the code when you want to calculate 3D histogram, first you create a zero matrix and then fill each index of it with the value of Red, Green and Blue Channel, I don't Understand why you plus value of each channel with 1. for example in here "rIndex = redChannel(row, column) + 1;"
Because you're counting the number of pixels that have that color. For example, let's say you were looking at the image and found a pixel had the RGB value of (111,222,190). So the count is one. Now let's say while you're scanning the image, you encounter another pixel with that same RGB value. So now there are two pixels. So since the histogram (count array) had a value 1 there (indicating it had so far found 1 pixel with that color), what do you think I should do to that value to make it now say there are two pixels with that color? You need to add 1 to the count. So if you take the existing value and add 1 you'll now have 2, which is the number of pixels you've encountered with that color so far.
Actually, your answer is related to "gamut3D(rIndex, gIndex, bIndex) = gamut3D(rIndex, gIndex, bIndex) + 1;" part. but I am asking why we plus the value of channels with one?! for example, if the value of red channel in row 2, column 1 = 128 we add it with 1 and save 129 in rindex. I hope my question be clear now?
Because indexes can't be zero, but gray levels can. You can't have indexes in the range 0-255, but youcan in the range 1-256 so that's why 1 is added to the index.
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Translated by
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.