Tigre

16 Reputation

2 Badges

16 years, 234 days

MaplePrimes Activity


These are answers submitted by Tigre

> restart;
> with(LinearAlgebra); with(linalg); with(plots); with(ListTools);
> with(ImageTools); with(stats);
> ImgPigeon := RGBtoGray(Read("c:/wavelets/pigeon.jpg")); View(ImgPigeon);
print(??); # input placeholder
> N := Height(ImgPigeon);
print(??); # input placeholder
> M := Width(ImgPigeon);
print(??); # input placeholder
> R := Array(1 .. N, 1 .. M, datatype = float[8], order = C_order);
print(??); # input placeholder
> for j to M do for i to (1/2)*N do R[i, j] := ImgPigeon[2*i-1, j]+ImgPigeon[2*i, j]; R[i+(1/2)*N, j] := ImgPigeon[2*i, j]-ImgPigeon[2*i-1, j] end do end do;
%;
> RT := Transpose(R);
print(??); # input placeholder
> N := Height(RT); M := Width(RT); S := Array(1 .. N, 1 .. M, datatype = float[8], order = C_order); for j to M do for i to (1/2)*N do S[i, j] := RT[2*i-1, j]+RT[2*i, j]; S[i+(1/2)*N, j] := RT[2*i, j]-RT[2*i-1, j] end do end do;
print(??); # input placeholder
> C := Transpose(S);
print(??); # input placeholder
> AbsTemp:=convert(abs(C), Array, datatype = float[8]); tempMax:=rtable_scanblock(AbsTemp, [rtable_dims(AbsTemp)], 'Maximum'); tempMin:= rtable_scanblock(AbsTemp, [rtable_dims(AbsTemp)], 'Minimum'); t1:=(tempMax+tempMin)/(2); cutoff:=0.01: tn:=5: while(tn > cutoff) tempS:=AbsTemp; tempUp:=Threshold(tempS,t1,method=below); tempDown:=Threshold(tempS,t1,method=above); tempMax:=rtable_scanblock(tempUp, [rtable_dims(tempUp)], 'Average'); tempMin:= rtable_scanblock(tempDown, [rtable_dims(tempDown)], 'Average'); t2:=(tempMax+tempMin)/(2); tn:=abs(t1-t2); t1:=t2; end do;

print(`output redirected...`); # input placeholder
Error, Got internal error in Typesetting:-Parse : "'_Inert_DELAYLESSTHAN' is not a valid inert form"
/
Typesetting:-mambiguous|AbsTempAssignconvertApplyFunction(absApplyFunction(C)
\

comma Arraycomma datatype equals float(8))semi tempMaxAssignrtable_scanblock

ApplyFunction(AbsTempcomma (rtable_dimsApplyFunction(AbsTemp))comma (Maximum

))semi tempMinAssign rtable_scanblockApplyFunction(AbsTempcomma (rtable_dims

(tempMax + tempMin)
ApplyFunction(AbsTemp))comma (Minimum))semi t1Assign-------------------semi
2

cutoffAssign0.01colon tnAssign5colon while(tn gt cutoff) tempSAssign

AbsTempsemi tempUpAssignThresholdApplyFunction(tempScommat1commamethod

equalsbelow)semi tempDownAssignThresholdApplyFunction(tempScommat1comma

methodequalsabove)semi tempMaxAssignrtable_scanblockApplyFunction(

tempUpcomma (rtable_dimsApplyFunction(tempUp))comma (Average))semi

tempMinAssign rtable_scanblockApplyFunction(tempDowncomma (rtable_dims

ApplyFunction(tempDown))comma (Average))semi t2Assign

(tempMax + tempMin)
-------------------semi tnAssignabsApplyFunction(t1 - t2)semi t1
2

Assignt2semi end dosemi, Typesetting:-merror("Got internal error in

\
Typesetting:-Parse : "'_Inert_DELAYLESSTHAN' is not a valid inert form"")|
/

Here is the process wanted not containted in a loop

View(AbsTemp);
> tempMax := rtable_scanblock(AbsTemp, [rtable_dims(AbsTemp)], 'Maximum'); tempMin := rtable_scanblock(AbsTemp, [rtable_dims(AbsTemp)], 'Minimum');
print(??); # input placeholder
> t1 := (tempMax+tempMin)*(1/2);
print(??); # input placeholder
> tempS := AbsTemp;
print(??); # input placeholder
> tempUp := Threshold(tempS, t1, method = below); tempDown := Threshold(tempS, t1, method = above);
print(??); # input placeholder
> tempMax := rtable_scanblock(tempUp, [rtable_dims(tempUp)], 'Average'); tempMin := rtable_scanblock(tempDown, [rtable_dims(tempDown)], 'Average');
print(??); # input placeholder
> t2 := (tempMax+tempMin)*(1/2);
print(??); # input placeholder
> tempUp := Threshold(tempS, t2, method = below); tempDown := Threshold(tempS, t2, method = above);
print(??); # input placeholder
> t3 := (tempMax+tempMin)*(1/2); tempMax := rtable_scanblock(tempUp, [rtable_dims(tempUp)], 'Average'); tempMin := rtable_scanblock(tempDown, [rtable_dims(tempDown)], 'Average');
print(??); # input placeholder
> tempUp := Threshold(tempS, t3, method = below); tempDown := Threshold(tempS, t3, method = above); tempMax := rtable_scanblock(tempUp, [rtable_dims(tempUp)], 'Average'); tempMin := rtable_scanblock(tempDown, [rtable_dims(tempDown)], 'Average'); t4 := (tempMax+tempMin)*(1/2);
 

Page 1 of 1