フィルターのクリア

I have a matlab code which i need to convert in C can anyone help

5 ビュー (過去 30 日間)
eric nunes
eric nunes 2011 年 6 月 23 日
[EDIT: 20110623 11:12 CDT - reformat - WDR]
clc;
I=imread('b2.bmp');
figure(1),imshow(I);
I=double(I);
[M,N] = size(I);
% blue_mask = repmat([1 0; 0 0], M/2, N/2);
% green_mask = repmat([0 1; 1 0], M/2, N/2);
% red_mask = repmat([0 0; 0 1], M/2, N/2);
%
% R=I.*red_mask;
% G=I.*green_mask;
% B=I.*blue_mask;
B = I(1:2:end,1:2:end);
G1 = I(1:2:end,2:2:end);
G2 = I(2:2:end,1:2:end);
R = I(2:2:end,2:2:end);
G = (G1+G2)/2;
figure(2), imagesc(R);
figure(3), imagesc(G);
figure(4), imagesc(B);
final(:,:,1)=R;
final(: ,:,2)=G;
final(: ,:,3)=B;
final=double(final);
final=final*125/15;
final=uint8(final);
% imshow(final)
% I = imread('b2.bmp');
% J = demosaic(I,'bggr');
% imshow(I);
% figure, imshow(J);

採用された回答

Walter Roberson
Walter Roberson 2011 年 6 月 23 日
The computations should be fairly easy.
You will have to find some kind of graphics library to do the figure() and imagesc() parts, as graphics is not part of C and cannot be implemented in standard C.
Reading BMP images is not part of the C language, but you should be able to find a third party library to do the reading for you, as that part can be implemented in standard C
  1 件のコメント
Chirag Gupta
Chirag Gupta 2011 年 6 月 23 日
You can look at openCV if you are fine with C++

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by