Distinguish color of the digits in an image












1















I am working on a task where I want to distinguish the digits in an image based on their colors. For example, in the images below, digits are divided into black, red, green and blue colors.



enter image description here



enter image description here



I have divided these image into sixteen small patches, and each patch contains one digit. My goal is to cluster the patches based on the color of the digits they have, so in the end there are 4 clusters for black, red, green and blue digits.
I am sure there are many approaches to do this, but I would like to know the best course of actions to complete this task efficiently. All suggestions would be greatly appreciated.










share|improve this question























  • What approaches have you tried?

    – kiner_shah
    Nov 25 '18 at 6:18






  • 1





    Until now the approach which is working best is that after dividing the image into sixteen small patches, I am removing the background of the digits to remove the noise due to background. After that I am converting the digit patches into CMYK color space and calculate the average CMYK for all pixels. After this I get average CMYK for each of the 16 patches. Than I use Kmeans clustering to cluster the digits into 4 clusters based on their average CMYK values, but it still make errors. I would like to know more suggestions.

    – adeelz92
    Nov 25 '18 at 6:25













  • K-means is sensitive to outliers, which is why you may be getting errors. Try different clustering method like K-medoids.

    – kiner_shah
    Nov 25 '18 at 6:29











  • K-medoids did not work very well too because of the fact that you need to choose data points as the initial centroids and in my case there is no way for us to choose 4 centroids from random image patches. If we choose wrong centroids, it does not work very well.

    – adeelz92
    Nov 25 '18 at 7:54








  • 1





    Your input images are very noisy, also jpeg compression artifacts are very visible, these must be helping by creating garbage in to produce garbage out. What have you tried to improve the image quality - can you completely avoid JPEG compression artifacts (i.e. NOT use jpeg format), or work with less (i.e. higher quality) JPEG compression so artifacts aren’t so destructive?

    – barny
    Nov 25 '18 at 16:46


















1















I am working on a task where I want to distinguish the digits in an image based on their colors. For example, in the images below, digits are divided into black, red, green and blue colors.



enter image description here



enter image description here



I have divided these image into sixteen small patches, and each patch contains one digit. My goal is to cluster the patches based on the color of the digits they have, so in the end there are 4 clusters for black, red, green and blue digits.
I am sure there are many approaches to do this, but I would like to know the best course of actions to complete this task efficiently. All suggestions would be greatly appreciated.










share|improve this question























  • What approaches have you tried?

    – kiner_shah
    Nov 25 '18 at 6:18






  • 1





    Until now the approach which is working best is that after dividing the image into sixteen small patches, I am removing the background of the digits to remove the noise due to background. After that I am converting the digit patches into CMYK color space and calculate the average CMYK for all pixels. After this I get average CMYK for each of the 16 patches. Than I use Kmeans clustering to cluster the digits into 4 clusters based on their average CMYK values, but it still make errors. I would like to know more suggestions.

    – adeelz92
    Nov 25 '18 at 6:25













  • K-means is sensitive to outliers, which is why you may be getting errors. Try different clustering method like K-medoids.

    – kiner_shah
    Nov 25 '18 at 6:29











  • K-medoids did not work very well too because of the fact that you need to choose data points as the initial centroids and in my case there is no way for us to choose 4 centroids from random image patches. If we choose wrong centroids, it does not work very well.

    – adeelz92
    Nov 25 '18 at 7:54








  • 1





    Your input images are very noisy, also jpeg compression artifacts are very visible, these must be helping by creating garbage in to produce garbage out. What have you tried to improve the image quality - can you completely avoid JPEG compression artifacts (i.e. NOT use jpeg format), or work with less (i.e. higher quality) JPEG compression so artifacts aren’t so destructive?

    – barny
    Nov 25 '18 at 16:46
















1












1








1


1






I am working on a task where I want to distinguish the digits in an image based on their colors. For example, in the images below, digits are divided into black, red, green and blue colors.



enter image description here



enter image description here



I have divided these image into sixteen small patches, and each patch contains one digit. My goal is to cluster the patches based on the color of the digits they have, so in the end there are 4 clusters for black, red, green and blue digits.
I am sure there are many approaches to do this, but I would like to know the best course of actions to complete this task efficiently. All suggestions would be greatly appreciated.










share|improve this question














I am working on a task where I want to distinguish the digits in an image based on their colors. For example, in the images below, digits are divided into black, red, green and blue colors.



enter image description here



enter image description here



I have divided these image into sixteen small patches, and each patch contains one digit. My goal is to cluster the patches based on the color of the digits they have, so in the end there are 4 clusters for black, red, green and blue digits.
I am sure there are many approaches to do this, but I would like to know the best course of actions to complete this task efficiently. All suggestions would be greatly appreciated.







python opencv colors computer-vision






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 25 '18 at 6:15









adeelz92adeelz92

10018




10018













  • What approaches have you tried?

    – kiner_shah
    Nov 25 '18 at 6:18






  • 1





    Until now the approach which is working best is that after dividing the image into sixteen small patches, I am removing the background of the digits to remove the noise due to background. After that I am converting the digit patches into CMYK color space and calculate the average CMYK for all pixels. After this I get average CMYK for each of the 16 patches. Than I use Kmeans clustering to cluster the digits into 4 clusters based on their average CMYK values, but it still make errors. I would like to know more suggestions.

    – adeelz92
    Nov 25 '18 at 6:25













  • K-means is sensitive to outliers, which is why you may be getting errors. Try different clustering method like K-medoids.

    – kiner_shah
    Nov 25 '18 at 6:29











  • K-medoids did not work very well too because of the fact that you need to choose data points as the initial centroids and in my case there is no way for us to choose 4 centroids from random image patches. If we choose wrong centroids, it does not work very well.

    – adeelz92
    Nov 25 '18 at 7:54








  • 1





    Your input images are very noisy, also jpeg compression artifacts are very visible, these must be helping by creating garbage in to produce garbage out. What have you tried to improve the image quality - can you completely avoid JPEG compression artifacts (i.e. NOT use jpeg format), or work with less (i.e. higher quality) JPEG compression so artifacts aren’t so destructive?

    – barny
    Nov 25 '18 at 16:46





















  • What approaches have you tried?

    – kiner_shah
    Nov 25 '18 at 6:18






  • 1





    Until now the approach which is working best is that after dividing the image into sixteen small patches, I am removing the background of the digits to remove the noise due to background. After that I am converting the digit patches into CMYK color space and calculate the average CMYK for all pixels. After this I get average CMYK for each of the 16 patches. Than I use Kmeans clustering to cluster the digits into 4 clusters based on their average CMYK values, but it still make errors. I would like to know more suggestions.

    – adeelz92
    Nov 25 '18 at 6:25













  • K-means is sensitive to outliers, which is why you may be getting errors. Try different clustering method like K-medoids.

    – kiner_shah
    Nov 25 '18 at 6:29











  • K-medoids did not work very well too because of the fact that you need to choose data points as the initial centroids and in my case there is no way for us to choose 4 centroids from random image patches. If we choose wrong centroids, it does not work very well.

    – adeelz92
    Nov 25 '18 at 7:54








  • 1





    Your input images are very noisy, also jpeg compression artifacts are very visible, these must be helping by creating garbage in to produce garbage out. What have you tried to improve the image quality - can you completely avoid JPEG compression artifacts (i.e. NOT use jpeg format), or work with less (i.e. higher quality) JPEG compression so artifacts aren’t so destructive?

    – barny
    Nov 25 '18 at 16:46



















What approaches have you tried?

– kiner_shah
Nov 25 '18 at 6:18





What approaches have you tried?

– kiner_shah
Nov 25 '18 at 6:18




1




1





Until now the approach which is working best is that after dividing the image into sixteen small patches, I am removing the background of the digits to remove the noise due to background. After that I am converting the digit patches into CMYK color space and calculate the average CMYK for all pixels. After this I get average CMYK for each of the 16 patches. Than I use Kmeans clustering to cluster the digits into 4 clusters based on their average CMYK values, but it still make errors. I would like to know more suggestions.

– adeelz92
Nov 25 '18 at 6:25







Until now the approach which is working best is that after dividing the image into sixteen small patches, I am removing the background of the digits to remove the noise due to background. After that I am converting the digit patches into CMYK color space and calculate the average CMYK for all pixels. After this I get average CMYK for each of the 16 patches. Than I use Kmeans clustering to cluster the digits into 4 clusters based on their average CMYK values, but it still make errors. I would like to know more suggestions.

– adeelz92
Nov 25 '18 at 6:25















K-means is sensitive to outliers, which is why you may be getting errors. Try different clustering method like K-medoids.

– kiner_shah
Nov 25 '18 at 6:29





K-means is sensitive to outliers, which is why you may be getting errors. Try different clustering method like K-medoids.

– kiner_shah
Nov 25 '18 at 6:29













K-medoids did not work very well too because of the fact that you need to choose data points as the initial centroids and in my case there is no way for us to choose 4 centroids from random image patches. If we choose wrong centroids, it does not work very well.

– adeelz92
Nov 25 '18 at 7:54







K-medoids did not work very well too because of the fact that you need to choose data points as the initial centroids and in my case there is no way for us to choose 4 centroids from random image patches. If we choose wrong centroids, it does not work very well.

– adeelz92
Nov 25 '18 at 7:54






1




1





Your input images are very noisy, also jpeg compression artifacts are very visible, these must be helping by creating garbage in to produce garbage out. What have you tried to improve the image quality - can you completely avoid JPEG compression artifacts (i.e. NOT use jpeg format), or work with less (i.e. higher quality) JPEG compression so artifacts aren’t so destructive?

– barny
Nov 25 '18 at 16:46







Your input images are very noisy, also jpeg compression artifacts are very visible, these must be helping by creating garbage in to produce garbage out. What have you tried to improve the image quality - can you completely avoid JPEG compression artifacts (i.e. NOT use jpeg format), or work with less (i.e. higher quality) JPEG compression so artifacts aren’t so destructive?

– barny
Nov 25 '18 at 16:46














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53465128%2fdistinguish-color-of-the-digits-in-an-image%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53465128%2fdistinguish-color-of-the-digits-in-an-image%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Ottavio Pratesi

Tricia Helfer

15 giugno