[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #46528] A(I): index out of bounds triggered.
From: |
andrefou |
Subject: |
[Octave-bug-tracker] [bug #46528] A(I): index out of bounds triggered. |
Date: |
Wed, 25 Nov 2015 13:03:50 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0 |
Follow-up Comment #2, bug #46528 (project octave):
Sorry I didn't gave all the babu function code I thought it was the end of it,
I hope you'll still be able to help. Indeed there is a value to return in the
end of the script.The complete babou code is :
function Quality=babu(img)
im=imread(img);
if length(size(im))>2
y=rgb2gray(im);
else
y=im;
end
[M N] = size(y);
f_len=8; % Filter Length
th=35; % Threshold for blocky edges.
ActTh=0.15; % Threshold for Activity
% Filters used
%background activity filter Horizontal and Vertical
fah=[1 -1 1 -1 1 -1 1 -1;zeros(1,8);-1 1 -1 1 -1 1 -1 1]./8;
fav=fah.';
%Low pass filter
ff=[1 0 1;0 0 0;1 0 1];
ff=ff/sum(sum(ff));
% prewitt H and V filter
PrH=[1 1 1;0 0 0;-1 -1 -1]./3;
PrV=PrH.';
%background luminance first result
yl=filter2(ff,y);
% background activity filtlered image H & V
yah=abs(filter2(fah,y));yah=yah./max(max(yah));
yav=abs(filter2(fav,y));yav=yav./max(max(yav));
% edge map H & V
difV=abs(filter2(PrV,y));
difH=abs(filter2(PrH,y));
% Activity Masking Weights with threshold
ActWV=double(~im2bw(yav,ActTh));
ActWH=double(~im2bw(yah,ActTh));
% Luminance Masking Weights
% HVS model 1) for 0-127 -> x/128 background luminance final result
% 2) for 128-255-> 1
LMW=sqrt(abs(yl/128).*double(~im2bw(yl/255,0.5))+im2bw(yl/255,0.5));
% Final Wts for Hzl and Vertical
TWV=LMW.*ActWH;
TWH=LMW.*ActWV;
% Remove the strong edges whose values are above th
% edgemap normalized H & V
Ilow=im2bw(difV/255,th/255);
MskH=double(~Ilow);
Ilow=im2bw(difH/255,th/255);
MskV=double(~Ilow);
%edge map * intermediate result * edge map normalized?
hisV1=sum(difV.*TWV.*MskV,1);
hisH1=sum(difH.*TWH.*MskH,2);
%median filtering with 1x8 blocks for V & H
%filtre moyenneur
%t=[1 40];%taille du filter
%H2 = fspecial('average',t);
%tv1 = imfilter(hisV1,H2);
%th1 = imfilter(hisH1,H2);
tv1=medfilt2(hisV1,[1,5]);
th1=medfilt2(hisH1,[5,1]);
%sum set to correspond for blockiness score
hisV=hisV1(8:8:end-8);
hisH=hisH1(8:8:end-8);
hisVa=tv1(8:8:end-8);
hisHa=th1(8:8:end-8);
%Quality retrieved from function created with both horizontal and vertical
blockiness
Quality=(1-sqrt(sum(abs(hisV-hisVa))*8/N+sum(abs(hisH-hisHa)))*8/M)*10;
-------------------------
Anyway the issue is surely not due to the script but on the loading, like the
string input is not well readed.
Thank you,
Andre
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?46528>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/