Eample Questons - Image Processng Lesson 5 Spatal Operatons onvoluton Queston : Prove that convoluton s commutatve, that s prove that: nswer hange of varable: Queston 2: Prove that convoluton s assocatve, that s prove that: nswer 2 M y y M M M Queston 6: Operate on an mage by performng Medan Flterng n a 33 wndow. Operate on the resultng mage by performng, agan, Medan Flterng n a 33 wndow. an the resultng mage be obtaned from a sngle Medan flterng? Queston 7: The α-percentle of a set of numbers s the number n the set for whch α% are larger than t. Medan s the 50-percentle. What wll happen to an mage f nstead of Medan flterng, we perform α-percentle flterng a wth α < 50? b wth α 0? NS: Image gets brghter. For α 0 s equvalent to MX operator.
Queston 8: Gven a 6464 mage of black 0 and whte 255 vertcal strpes each strp s of wdth 8 : 64 Queston 9: נתונה תמונה בגודל. 0050 סכום דרגות האפור בתמונה הוא 640,000. מבצעים קונבולוציה של התמונה עם המסכה. על התוצאה מבצעים קונבולוציה עם המסכה. א. מה יהיה סכום דרגות האפור בתמונה שתתקבל בסוף. הסבר/הוכח. ב. מה יהיה סכום דרגות האפור בתמונה שתתקבל לו היינו מבצעים קונבולוציה עם המסכה ואחר כך עם המסכה. 8 { The followng operatons are performed on the mage: lurrng by convoluton wth: 2 Hstogram Equalzaton. 64 6 2 2 4 2 2 Queston 0: - - - h 2 2 4 2 2-4 6-4 -4 6-24 6-4 6-24 36-24 6-4 6-24 6-4 -4 6-4 נתונה המסכה : h 3 Hstogram Equalzaton, agan. What wll the mage look lke after each one of the above operatons f before each operaton, thresholdng s performed at value 28 gray values [0..27] -> 0, gray values [28..255] -> 255. א. מצא זוג מסכות חד ממדיות g g, 2 כך שקונבולוציה של תמונה כלשהיא עם g ואח"כ עם g 2 תיתן תוצאה זהה לזו שתתקבל מקונבולוציה של התמונה עם h. ב. מצא 4 מסכות חד ממדיות l l 2 l 2 l 22 כך שקונבולוציה של תמונה כלשהיא עם l אח"כ l 2 אח"כ l 2 ולבסוף l 22 תיתן תוצאה זהה לזו שתתקבל מקונובולוציה של התמונה עם h. רמז: השתמש בסעיף א ג. מצא 2 מסכות k k 2 בגודל 3X3 כך שקונבולוציה של תמונה כלשהיא עם.h תיתן תוצאה זהה לזו שתתקבל מקונבולוציה עם ואח"כ עם k 2 k Queston : נתונה תמונה בגודל. 2525 מבצעים קונובלוציה של התמונה עם המסכה h 999 פעם. המספר h 0 0.5 0 0.5 0.4 0.5 0 0.5 0 בסוף תהליך הקונבולוציה מבצעים floor על כל פיקסל floorp השלם הגדול ביותר הקטן או שווה ל P. Queston 2: 0 0 0 0 0 0 0 0 0 כיצד תראה תוצאת הקונבולוציה כאשר: הקונבולוציה מתבצעת עם אפסים מחוץ לתמונה.. כאשר הקונבולוציה מתבצעת באופן ציקלי. 2. 0 0 0 0 0 0 0 0 2 נתונות המסכות הבאות: 4. נתונות שתי סדריות חד מימדיות: [0 0 2 3 4 5 0 0] [0 0 2 3 4 5 6 0 0] כ"כ נתונות תוצאות הקונבולוציות הבאות עם מסכה לא ידועה הנח ריפוד באפסים: [0 2 3 7 5 7 5 0] [0 4 4 5 9 9 8 0] מה תהינה תוצאות הקונבולוציות הבאות. נמק ללא שחזור. [0 0 4 7 0 3 6 0 0].I [0 0 2 4 6 8 0 0 0].II [0 0 0 2 3 4 5 0].III.IV מהו סכום הערכים שבמסכה. נמק. ב. תהי D מסכה לא ידועה בגודל 22. תכנן סדרה של קלטים תמונות בגודל כלשהוא כך שמתוך תוצאות הקונבולוציה שלהן עם מסכה D ניתן לקבוע את ערכי D. הנח ריפוד באפסים או ריפוד ציקלי - לבחירתך. הסבר. 2 א. 6 2 2 4 2 2 36 3 3 3 3 2 3 3 3 3 דרג אותן לפי מידת ה"נזק" שהן גורמות לתמונה במידה ונבצע איתן קונבולוציה. מידת ה"נזק" נמדדת ע"פ מידת הקושי לשחזר את התמונה המקורית. הנח קונבולוציה עם ריפוד אפסים. הסבר מיקומו של כל מסכה בדירוג.
ש ג. בכל אחד מהמקרים הבאים, קבע האם קיימת מסכה? E נמק תשובותיך על סמך תכונות הקונבולוציה ללא שחזור E. הנח ריפוד הקלט באפסים. תוצאות הקונבולוציה אינן מקוצצות לגודל התמונה המקורית אך אפסים בקצוות מקוצצים. תוצאות ניתנות עד כדי הזזה ז"א הראשית איננה מסומנת בתוצאה.,,,, 0, 2 E 2,,3 0,,, 0, 0,, E 2,2,2,2,2,,2,2,,2,..ג E: NOT possble. Snce the output s the same sze as nput, the mask must be of length I.e. s sngle constant. However there s no constant that multples the nput to produce the output. E2: NOT possble. Several eplanatons: a the sum of pel rato between nput and output are not constant nput 2,3 the rato s 2 whereas for nput the rato s 2.5. The length of the output ncreases by 2 for nput mplyng a mask of length 3 and ncreases by for nputs 2,3 mplyng mask of length 2. E3: IS possble. E3[,5,-7]. The outputs are shfted. Snce the zeros have been erased and the orgn have not been marked, t s possble that the 2 outputs are shfted. 0,, 0 0, 0, -7, 5, 4, 7, 6 E 3-7, 5, 0, 0, 0 E 4 4,3,-4,-5,6 2,,0,,3 E4: NOT possble. onvoluton wth a 0 nput produces a 0 output regardless of mask. E5: IS possble: The left shft n nput 2 looks lke produced a rght shft, however due to deleted zeros and unmarked orgn, t s possble that the output s ndeed left shfted. lso, addtvty s preserved. 0,0,,3,0 0,,3,0,0 0,,4,3,0 0,, 0 0, 0, 0,, 4 8 9 63 0 E 5 0 4 8 9 63,, E 6 4,7,8,9,0 4 2 7 72 63 E 7 4,-2, 5 4,-2, 5 8,-4,0 E6: NOT possble. There s no such mask. The output s ncreasng values and ths s mpossble for the nput. Values must decrease from a certan pont n output. E7: NOT possble. Shft nvarance IS preserved agan because the zeros are deleted. ddtvty s not preserved snce nput 3 s the sum of nputs and 2 but the output of 3 s the sum of outputs and 2 WITHOUT the shft. lso: Output 3 s double output, however nput 3 s NOT double nput, whch contradcts lnearty. NOTES: Masks can be of sze or larger. The values n a mask are not necessarly whole or ntegers I.e. they may be fractons. The fact that ratos between nput and output are preserved s NOT enough to prove the estence of a mask. תשובה לשאלה מספר 3 שאלה מספר 3 אילו מהפעולות הבאות ניתן לבצע ע"י קונבולוציה. הסבר או תן מסכה מתאימה. הנח קונבולוציה ציקלית או עם ריפוד של אפסים לבחירתכם. אל תדאגו לבריחת דרגות האפור אל מחוץ לתחום 255...0. אילו מהפעולות הבאות ניתן לבצע ע"י קונבולוציה. הסבר או תן מסכה מתאימה. הנח קונבולוציה ציקלית או עם ריפוד של אפסים לבחירתכם. אל תדאגו לבריחת דרגות האפור אל מחוץ לתחום 255...0. טשטוש שינוי קונטרסט ללא שינוי הממוצע שינוי הממוצע ללא שינוי הקונטרסט שכפול תמונה שיווי היסטוגרמה לקיחת סף הזזת תמונה נגטיב של תמונה הגדלת תמונה סיבוב תמונה החלפת כל פיקסל בממוצע השכנים של הפיקסל שמימינו ללא הפיקסל שמימינו..2.3.4.5.6.7.8.9.0. /9 /9 /9 /9 /9 /9 /9 /9 /9 טשטוש - כן למשל: שינוי קונטרסט ללא שינוי הממוצע - כן. לדוגמא בסעיף לא משנה את הממוצע אך כן את הקונטרסט ברוב המקרים. שינוי הממוצע ללא שינוי הקונטרסט לא ניתן כי יש צורך להוסיף\להפחית ערך קבוע מכל פיקסל וזה לא ניתו לביצוע ע"י קונבולוציה. שכפול תמונה - כן, למשל ע"י:..2.3.4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 שיווי היסטוגרמה לא, אין זה תהליך לינארי. לקיחת סף כנ"ל הזזת תמונה - כן, למשל 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ראשית.5.6.7 נגטיב של תמונה כן, ע"י קונבולוציה עם: -.ל. אין צורך לדאוג דרגות אפור 255..0 הגדלת תמונה לא ניתן, כיון שמה שמתבצע בכל פיקסל תלוי במיקומו קואורדינטות של הפיקסל וקונבולוציה פועלת באופן הומוגני. סיבוב תמונה לא, כנ"ל החלפת כל פיקסל בממוצע השכנים של הפיקסל שמימינו ללא הפיקסל שמימינו כן:.8.9.0. 0 ראשית
שאלה מספר 2004-5 אילו מהפעולות הבאות ניתן לבצע ע"י קונבולוציה. הסבר או תן מסכה מתאימה. הנח קונבולוציה ציקלית או עם ריפוד של אפסים לבחירתכם. אל תדאגו לבריחת דרגות האפור אל מחוץ לתחום 255...0. אין להתיחס למסכות טריביליות שכל ערכיהם 0 כתשובה. הגדלת הממוצע לערך k נתון הגדלת הקונטרסט פי 2 IDEL Hgh Pass Flterng Homomorphc Flterng העתקת תמונה 3 פעמים החלפת כל פיקסל בפיקסל הנמצא 4 מקומות ימינה ו- 2 למטה. שיקוף התמונה לא משנה מיקום הציר החלפת כל פיקסלי התמונה לערך קבוע איפוס הפיקסל אשר מוקף שכנות- 8 בפיקסלים בהירים ממנו פי שניים lateral Flterng נגזרת בציר ה- ועוד נגזרת בציר ה- y..2.3.4.5.6.7.8.9.0.. 2. 3. 4. 5. No f avg gray level of mage s not known. Yes f avg gray level of mage s known: In ths case f mage avg s M then a mask whch changes avg of mage to k would be for eample a mask wth value k/m. oth answers were accepted. Yes Use a mask wth value 2. Ths mask multples all gray values by 2. Thus the ma and mn gray values are multpled by two and so s ther dfference. Yes ny flterng n the Fourer doman can be mplemented usng convoluton n the spatal doman The convoluton theorem. If H s the hgh-pass flter then I - {H} s the approprate convoluton mask. No Homomorphc Flterng requres takng the log of mage values. Log s a non-lnear operaton and can not be performed usng convoluton. Yes Usng a mask composed of 3 delta functons: e.g. δ-0,y-y0 + δ-,y-y + δ-2,y-y2 תשובה לשאלה מספר 2004-5 6. Yes usng the followng Mask: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 orgn 7. 8. Do not forget that the mask s flpped when used n convoluton. No Reflecton changes pel values dependent on the coordnates. onvoluton does not take nto account coordnates. Yes Usng a mask of ones the sze of the mage or multples thereof and assumng cyclc convoluton, creates an mage wth constant values equal to the sum of mage pels. 9. 0. No Determnng that LL surroundngpels are EXTLY twce the value of the center pel, requres an f operaton. Ths can not be done usng convoluton. Yes The followng mask DOES zero out pels wth surroundng pels double n value. It also zeros out many other confguratons but ths was not specfcally stated n queston. oth answers were accepted. No lateral Flterng sets values accordng to dstance of neghborng pels whch N be done usng convoluton, but also a weghtng on the dfference between gray values of the neghbors and current pel ths N NOT be done usng convoluton.. Yes the masks for d/d and d/dy are: - - and the mask for d/d + d/dy s by addtvty/dstrbutvty of convoluton: 2 - - 0-6 256 256 עם הטקסטורה הבאה: M λ { m : Im λ I and m s of sze 55 } שאלה מספר 2004-5 3 תהי I תמונת טקסטורה בגודל 0 שחור, לבן. נגדיר קבוצת מסכות: כלומר זוהי קבוצת מסכות בגודל 55 שאם נבצע קונבולוציה בינן לבין התמונה I, נקבל את התמונה I כפול λ סקלאר כלשהוא. א. כמה איברים בקבוצה M? λ הסבר. ב. מה סכום הפיקסלים של איבר ב-? M λ הסבר. ג. מצאו 3 דוגמאות של איברים מ M λ כשכל דוגמא בעלת נורמה שונה עבור 3λ. נורמה של מטריצה מוגדרת כסכום ריבועי האיברים במטריצה.
nswer to Queston 3 ssume wthout loss of generalty that the orgn s at the center of the masks. We mark the mask entres as a and b as follows: m a b a 2 b 2 a 3 b 3 a 4 b 4 a 5 b 5 a 6 b 6 a 7 b 7 a 8 נגדיר 3 מסכות: שאלה מספר 2004-5 ב. תהי f תמונת דרגות אפור בגודל 256. 256 h [ - ] h 2 256 - b 8 a 9 b 9 a 0 b 0 א a b 2 a 3 b 3 a 4 Snce Im λ I we have 2 constrants: when mask orgn s on an mage pel wth value : suma λ when mask orgn s on an mage pel wth value 0: sumb 0 h 3 256 ב ג Snce we have 2 constrants and 25 unknowns the number of masks s unbounded nfnte. From the above two constrants we have that suma+sumb λ There are nnte number of possbltes. Eample: a set a7 λ and all others 0. b set a4 a5 λ/2 and all others 0. c set a4 a9 a0 λ/3 and all others 0. g f h g 2 f h 2 g 3 f h 3 נגדיר: בהנתן g, g 2, g 3 האם ניתן לשחזר את התמונה המקורית אם כן תן אלגוריתם, אם לא תן דוגמא נגדית. קונבולוציה ציקלית f באופן מדויק? Gven g, g 2 and g 3 : From g we can calculate each row up to a scale factor: From g 2 we can calculate each column up to a scale factor. Thus, from g and g 2 we can calculate the mage f up to a scale factor. Scale factor can be determned from g 3 whch contans the mage D. lg: % reconstruct frst row f, ; f, f,- + g,; % reconstruct all columns f, f-, + g 2, שאלה מספר א. האים הפעולות הבאות קומוטטיביות? הפעולות מופעלות על תמונות דרגות אפור דו-מימדיות. הוכח כל תשובה! הפעלת מסנן flter ממוצע ואחר כך מסנן חציון? הפעלת מסנן MX על שורות ואחר כך מסנן MX על העמודות? הפעלת מסנן MX על שורות ואחר כך מסנן MIN על העמודות? תשובה לשאלה מספר הפעלת מסנן MX בגודל k k ואחר כך מסנן MIN בגודל? k k הפעלת מסנן חציון על שורות ואחר כך מסנן חציון על העמודות? הפעלת מסנן Hgh Pass ואחר כך מסנן.Low Pass.I.II.III.IV.V.VI % correct for scale factor f f - meanf: + g 3,./lengthg:
א I. No. Eample: consder the followng mage wth values 0,: II. III. 0 0 0... verage flterng say 3 unform mask wll produce non whole numbers between 0 and and the followng medan flterng wll be a non whole number. Medan flterng the mage say wth a 3 wndow wll produce an all mage and followng wth the average flterng wll mantan. Yes, Proof : ssume masks are of sze k and k. wth orgn at frst pel. For any gven pel 0,y0, the regon of nfluence s a square kk wndow startng at the pel. ssume that the mamum value wthn ths wndow s p located at coordnates,y. Ma on rows wll set coordnate 0,y to value p. Ma on cols wll cause coordnate 0,y0 to get value p. Ma on cols wll set coordnate,y0 to value p. Ma on rows wll set coordnate 0,y0 to value p. No, Eample: onsder a 2 and 2 szed masks. For any gven pel 0,y0 the regon of nfluence s a 22 wndow. onsder the followng wndow: 0 0,y0 0 Ma on rows followed by Mn on cols wll set coordnate 0,y0 to. Mn on rows followed by Ma on cols wll set coordnate 0,y0 to 0. פתרון שאלה מספר IV. No. Eample: onsder a 22 and 22 szed masks. For any gven pel 0,y0 the regon of nfluence s a 33 wndow. onsder the followng wndow: 0,y0 Ma followed by Mn wll set coordnate 0,y0 to. Mn followed by Ma wll set coordnate 0,y0 to 0. V. No. Eample: onsder a 3 and 3 szed masks. For any gven pel 0,y0 the regon of nfluence s a 33 wndow. onsder the followng wndow: 2 0 0 0,y0 2 VI. 0 0 0 0 0 2 0 2 Medan on rows followed by Medan on cols wll set coordnate 0,y0 to. Medan on cols followed by Medan on rows wll set coordnate 0,y0 to 2. Yes. Proof: oth low and hgh pass can be mplemented usng convoluton and convoluton s commutatve. Note: there s no restrcton on the frequency bands n the low and hgh pass flterng so that frequency bands may or may not overlap. שאלה מספר 2 נתונה תמונה חד מימדית I מחזורית מספר שלם של מחזורים ומסכה חד מימדית H. האם תוצאת הקונבולוציה I H גם כן מחזורית? הוכח! שאלה מספר נתונה תמונה חד מימדית I ומסכה חד מימדית H. האם ניתן לבצע קונבולוציה I H ע"י כפל מטריצות? אם כן תאר את מטריצות ההכפלה, אם לאו הסבר! א. עבור קונבולוציה בריפוד אפסים. ב. עבור קונבולוציה ציקלית. I? H I H