document image binarization [closed] - matlab

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm trying to find effective binarization techniques for document images. I've currently implemented the niblack and sauvola thresholding algorithms and tried binarization based on histogram evaluation as well. Could someone please suggest other binarization methods that have proved to be effective?
Here's a sample degraded image I've been working with:
http://spie.org/Images/Graphics/Newsroom/Imported/0681/0681_fig1.jpg
Any suggestions will be much appreciated.

How about starting with simply adapting the threshold based on the local neighborhood?
im = rgb2gray(im);
im = im2double(im);
f_makebw = #(I) im2bw(I.data, double(median(I.data(:)))/1.45);
bw = ~blockproc(im, [128 128], f_makebw);
Result:

Related

Matlab convex optimisation toolbox. Optimisation variable not shown [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I'm using the convex optimisation toolbox in matlab and the objective function gets minimized and the value is shown. But the optimisation variable for which minima is achieved, I cannot find. Will someone tell me how to find it?
You didn't say which function you are using to perform the optimization, but most or all of them return the location of the minimum as the first argument. See fmincon for example.

How to find and display a graph of mean square error as a function of quality factor using Matlab? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Our teacher wants us to print at Matlab a graph that plots, in the x axis, the quality factor, and on the y axis the mean square error. The image is the known "lenna.jpg".
I've searched and found how to find the mse, but I didn't find anything that helps me on how we find the quality factor.
So, can you please tell me in Matlab code, how to find these 2 things and how to display them in a graph?
Thanks in advance.
I don't have matlab available right now, but I think the following should work:
original=imread('lena.jpg');
mse=zeros(1,100);
for q = 1:100
tempFile = sprintf('lena%03d.jpg', q);
imwrite(original, tempfile, 'quality', q);
thisOne = imread(tempfile);
mse(q) = sum((original - thisOne).^2)/numel(thisOne);
end
figure
plot(1:100, mse)
xlabel 'quality factor'
ylabel 'MSE'
title 'Degradation of Lena.jpg with quality factor'

How to estimate next values on Matlab [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a vector of values corresponding to the measured data and I want to predict the next values. How can I do that? I know that is possible with Kalman filter but it might be an easier way to do. Here is a plot of the data and I want to predict next values:
Try exponential smoothing, e.g., double exponential smoothing or Holt-Winters method. Basically you try to learn the trend of the data.
I have some sample python code in this post.
On the other hand, if you know the movement/observation model of the underline variable, for sure, kalman will give you much better predictions as #tomasz74 pointed out.

Coding k-means algorithm in MATLAB [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Could you help me to write matlab simple code for k-means algorithm without using the algorithm in matlab toolbox ? So i want to work with array and plot the clusters with unique colors. For example i have an array=[1 2; 3 4 ; 5 6] with 2 clusters; some points will be red some points are blue at the end the program should plot the array in axis. then using the k-means algorithm. at the end. plot clusters in graphical interface.
can you help me?
If you want to see how MATLAB does it, type
edit kmeans
into the command window. This might give you some hints.
An easier place to start would probably be the wikipedia page, which has the basic algorithm succinctly outlined.

How to generate samples from a random number generator in matlab? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have a random number generator function. I want to use this function to generate 100 samples for simulation and make a histogram of it. Can anybody tell me how I can do in Matlab?
This random number generator is from a distribution.
The simplest way is just to call it in a loop:
x = zeros(1,100);
for i = 1:100
x(i) = my_func();
end
And then:
hist(x)