How I can write code for training and then do classification using naive Bayes either image is noisy or not ?
Show older comments
I am a new user of MATLAB and want to do training and classification using naive Bayes. I have done it with confusion matrix but want to take result in the form of image. I am dealing with noisy images and want to classify either a given image is noisy or not?
I have matrix of features and matrix of (defined) Labels, How I can train and then do classification (using some sample image) either is it noisy or not ?
Please help, I shall be very thankful to you. Waiting for your kind response.
Answers (1)
Image Analyst
on 18 May 2017
0 votes
I haven't used it yet, but have you tried putting your feature vectors into fitcnb()?
5 Comments
shafaq nisar
on 19 May 2017
Image Analyst
on 19 May 2017
Like I said, I haven't used it. I'd have to research it just like you'd have to. So, since you have the time to delve into it and I don't have enough time to do that for you today, I think you should do it.
Since you must have a reference image to determine the level of noise, why don't you just use immse() or psnr() to determine the noise level and classify the image into noisy or not based on those values?
Don Mathis
on 26 May 2017
You say you want to do classification of images as noisy vs not noisy. That's a binary response. What do you mean when you say you want to show the result in the form of an image, or on an image? Do you want to display a yes/no answer overlaid on an image?
shafaq nisar
on 4 Jun 2017
Don Mathis
on 5 Jun 2017
Edited: Don Mathis
on 5 Jun 2017
I'm sorry but I still don't understand. Your example code does not return the result in the form of an image. The line
result = svmclassify(SVMStruct, lionTest);
returns a class label, which is probably a string like 'lion'. On the svmclassify Doc page (<http://www.mathworks.com/help/stats/svmclassify.html?searchHighlight=svmclassify&s_tid=doc_srchtitle#outputarg_Group)>, there is an example that shows that the result returned is a class label, in this case strings. Maybe you are saying that you want to return an example image from the same class as the classifier result? In that case you could take the string 'lion' and return the first lion image from your training set. Or, in your case I suppose your labels would be 'noisy' or 'not noisy', and so you would show a random noisy image?
Categories
Find more on Naive Bayes in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!