《量化投资:以MATLAB为工具》

MATLAB技术论坛

 找回密码
 注册账号
楼主: dynamic
收起左侧

[数运] 离散数据点拟合圆方程Matlab代码

  [复制链接]
发表于 2009-4-19 13:32:02 | 显示全部楼层
很好很好很好很好很好很好很好很好很好很好很好很好很好很好很好很好很好
发表于 2009-4-21 15:58:28 | 显示全部楼层

thank you!!! 谢谢!!!!!
发表于 2009-6-2 10:38:24 | 显示全部楼层
好帖子呀  希望斑竹以后多发这样好的帖子
发表于 2009-6-4 22:53:13 | 显示全部楼层
谢谢!!支持支持支持!!!!
发表于 2009-6-4 23:47:14 | 显示全部楼层

111

1111111111111111sssssssssssssssssssss
发表于 2009-6-11 21:19:26 | 显示全部楼层
发表于 2009-6-12 17:12:16 | 显示全部楼层

求助~~谁能调试这个贝叶斯图像分割程序

求助~~谁能调试这个贝叶斯图像分割程序

哪位老大粗来调试一下。。。谢谢~!
能调好的发到我的email:nasir82@163.com。。
-----------------------------------------------------------------------------------------
clear all

source = imread('/home/velmurugan/matlab/bin/ritu.JPG');


thresh = 25;

bg = source; % read in 1st frame as background frame
bg_bw = double(rgb2gray(bg)); % convert background to greyscale

% ----------------------- set frame size variables
-----------------------
fr_size = size(bg);
width = fr_size(2);
height = fr_size(1);
fg = zeros(height, width);

% --------------------- process frames
-----------------------------------

%for i = 2:length(source)

    fr = imread('/home/velmurugan/matlab/bin/ritu1.JPG');
    fr_bw = rgb2gray(fr); % convert frame to grayscale

    fr_diff = abs(double(fr_bw) - double(bg_bw)); % cast operands as
double to avoid negative overflow

    for j=1:width % if fr_diff > thresh pixel in
foreground
         for k=1:height

             if ((fr_diff(k,j) > thresh))
                 fg(k,j) = fr_bw(k,j);
             else
                 fg(k,j) = 0;
             end

             if (fr_bw(k,j) > bg_bw(k,j))
                 bg_bw(k,j) = bg_bw(k,j) + 1;
             elseif (fr_bw(k,j) < bg_bw(k,j))
                 bg_bw(k,j) = bg_bw(k,j) - 1;
             end

         end
    end

    figure(1),subplot(3,1,1),imshow(fr)
    subplot(3,1,2),imshow(uint8(bg_bw))
    subplot(3,1,3),imshow(uint8(fg))
    fg1=uint8(fg);
    imwrite(fg1, '/home/velmurugan/matlab/bin/ritu2.jpg' , 'jpg')


after performing this, the output image iam using your code.(given
below)
clc;
clear all;
disp('Creating Blobs.m...');
originalImage = imread('ritu31.jpg'); % Read in image
%binaryImage = im2bw(originalImage, 0.4); % Threshold to binary
thresholdValue = 100;
%binaryImage = originalImage;
binaryImage = originalImage > thresholdValue; % Alternate way to
threshold.
%binaryImage = imfill(binaryImage, 'holes');

subplot(3,2,1); imagesc(originalImage); colormap(gray(256)); title
('Original Image');
subplot(3,2,2); imagesc(binaryImage); colormap(gray(256)); title
('Binary Image');

labeledImage = bwlabel(binaryImage, 8); % Label each blob so can
do calc on it
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle'); %
pseudo random color labels

% Save the labeled image as a tif image.
% imwrite(uint16(labeledImage), 'tif_labels.tif');
% tifimage = imread('tif_labels.tif');
% imtool(tifimage, []); % Use imtool so she can inspect the values.

subplot(3,2,3); imagesc(labeledImage); title('Labeled Image');
subplot(3,2,4); imagesc(coloredLabels); title('Pseudo colored
labels');

blobMeasurements = regionprops(labeledImage, 'all'); % Get all the
blob properties.
numberOfBlobs = size(blobMeasurements, 1);

% bwboundaries returns a cell array, where each cell
% contains the row/column coordinates for an object in the image.

% grayscale image using the coordinates returned by bwboundaries.
subplot(3,2,5); imagesc(originalImage); title('Outlines');
hold on;
boundaries = bwboundaries(binaryImage);
for k = 1 : numberOfBlobs
        thisBoundary = boundaries{k};
        plot(thisBoundary(:,2), thisBoundary(:,1), 'g', 'LineWidth',
2);
end
hold off;

fprintf(1,'Blob # Mean Intensity Area Perimeter Centroid
\n');
for k = 1 : numberOfBlobs % Loop through all blobs.
        % Find the mean of each blob. (R2008a has a better way where
you can pass the original image
        % directly into regionprops. The way below works for all
versions including earlier versions.)
    thisBlobsPixels = blobMeasurements(k).PixelIdxList; % Get list of
pixels in current blob.
    meanGL = mean(originalImage(thisBlobsPixels)); % Find
mean intensity (in original image!)
        blobArea = blobMeasurements(k).Area; % Get area.
        blobPerimeter = blobMeasurements(k).Perimeter; % Get
perimeter.
        blobCentroid = blobMeasurements(k).Centroid; % Get
centroid.
    fprintf(1,'#%d %18.1f %11.1f %8.1f %8.1f %8.1f\n', k, meanGL,
blobArea, blobPerimeter, blobCentroid);
end
----------------------------------------------------------------------------------------------------
发表于 2009-6-12 18:17:36 | 显示全部楼层
发表于 2009-7-13 17:04:39 | 显示全部楼层
嗯,真的很不错!又学习了一翻!
发表于 2009-7-14 19:23:42 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|网站地图|MATLAB技术论坛|Simulink仿真论坛 ( 蜀ICP备19014457号 

GMT+8, 2020-2-19 11:13 , Processed in 0.090498 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表