中間值
中間值
中間值(median value),指將試驗得到的若干數值以遞增(或遞減)的次序依次排列時,若數值的數目是奇數,中間的那個值或若數值的數目是偶數,中間兩個數值的平均值。
目錄
Photoshop【中間值】:濾鏡通過混合選區中像素的亮度來減少圖像中的雜色。該濾鏡通過搜索像素選區的半徑範圍來查找亮度相近的像素,清除與相鄰像素差異太大的像素,並用搜索到的像素的中間亮度值替換中心像素。此濾鏡在消除或減少圖像中的動感效果時非常有用。
已知有三個16位二進位的數,找出中間大小的數,當有兩數相等時,取相等的數
ORG 0000H AJMP MAIN ORG 0030HMAIN:MOV SP,#60H;40H,41H為A1,42H,43H為A2,44H,45H為A3中值方入R2和R3中,前高后低MMN:MOV 30H,40H MOV 31H,41H MOV 32H,42H MOV 33H,43H LCALL BIJIAOS CJNE R1,#0,NN0 當R1為0時,則A1和A2相等,中值取A1 MOV R2,30H MOV R3,31H RETNN0: CJNE R1,#1,NN1 R1為1,A1小於A2 MOV 30H,40H MOV 31H,41H MOV 32H,42H MOV 33H,43H LCALL BIJIAOS CJNE R1,#0,SS0 R1為0,則A1和A3相等,中值取A1 MOV R2,40H MOV R3,41H RETSS0: CJNE R1,#1,SS1 R1等於1,則A1小於A3,A1小於A2 MOV 30H,42H MOV 31H,43HMOV 32H,44H MOV 33H,45H LCALL BIJIAOS CJNE R1,#1,PP0 R1等於0則A2等於A3,又A1小於A3,A1小於A2,取A2 MOV R2,42H R1等於1則A2小於A3,又A1小於A2,取A2 MOV R3,43H RETPP0: MOV R2,44H R1等於2或等於0,則A2大於或等於A3,又A3大於A1,取A3 MOV R3,45H RETSS1: MOV R2,40H R1等於2,A1大於A3,又A1小於A2,取A1 MOV R3,41H RETNN1: MOV 30H,40H A1大於A2,A1與A3比較 MOV 31H,41H MOV 32H,42H MOV 33H,43H LCALL BIJIAOS CJNE R1,#0,SS2 A1等於A3,取A1 MOV R2,40H MOV R3,41H RETSS2: CJNE R1,#1,SS3 A1小於A3,取A1 MOV R2,40H MOV R3,41H RETSS3: MOV 30H,42H A1大於A3,A1大於A2,A2與A3比較 MOV 31H,43H MOV 32H,44H MOV 33H,45H LCALL BIJIAOS CJNE R1,#1,PP2 R1等於1,A2小於A3,又A1大於A2,A3,取A3 MOV R2,44HMOV R3,45H RETPP2: MOV R2,42H R1不等於1,則A2不小於A3,取A2 MOV R3,43H RET;30H,31H為B1,32H,33H為B2;BIJIAOS:MOV A,30H B1等於B2 R1等於0,小於時R1為1,有大於R12CJNEA,32H,LOOP0 MOV A,31H CJNE A,33H,LOOP0 MOV R1,#0 RETLOOP0: JNC LOOP1 MOV R1,#1 RETLOOP1: MOV R1,#2 RET END