필터 지우기
필터 지우기

couldn't find what's wrong

조회 수: 1 (최근 30일)
amira hl
amira hl 2015년 6월 6일
편집: Walter Roberson 2015년 6월 6일
this is my code
clc; clear all; close all;
im=imread('images.jpg');
size(im);
fid=fopen('document.txt','r');
c = fread(fid, 'uint8=>char')';
bin=dec2bin(c);
a=size(bin,1)*size(bin,2);
b=1
delta=20
wi=bin(3)
f=im(3,3)
m=floor(f/((2^b)*delta))
r=f-(2^b)*m*delta
f1=(2^b)*m*delta+wi*delta+r/(2^b)
in execution
b =
1
delta =
20
wi =
1
f =
7
m =
0
r =
7
f1 =
255
the value of f1 should be 24
I think the problem is in saving wi=bin(3) value in matlab because when I put wi=1; manually in my code it gives me 24 but my main code involves a loop and every time wi will take a new value from bin table
why is f1=255??
thank you

채택된 답변

Walter Roberson
Walter Roberson 2015년 6월 6일
dec2bin returns '1' not 1.'1' is char(49)
  댓글 수: 1
amira hl
amira hl 2015년 6월 6일
thank you Walter Roberson

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by