School Projects‎ > ‎

Image Recognition

This application will detect objects in an image.  The program has two main steps, the learning step, and the detection step.  



The first thing this application does it learns the features of the various sample objects.


S0: Size: 6322 Perimeter: 330 Moment: 15219,-11408 Compactness: 17 Elongatedness: 1894 Euler Number: 1

S1: Size: 6174 Perimeter: 318 Moment: 15591,-11690 Compactness: 16 Elongatedness: 1564 Euler Number: 1

S2: Size: 4761 Perimeter: 272 Moment: 20308,-15227 Compactness: 15 Elongatedness: 1000 Euler Number: 1

S3: Size: 10856 Perimeter: 332 Moment: 8734,-6553 Compactness: 10 Elongatedness: 1034 Euler Number: 1

S4: Size: 9679 Perimeter: 444 Moment: 9828,-7370 Compactness: 20 Elongatedness: 1034 Euler Number: 0

S5: Size: 6775 Perimeter: 499 Moment: 14176,-10626 Compactness: 36 Elongatedness: 1302 Euler Number: 1

S6: Size: 6230 Perimeter: 333 Moment: 15452,-11574 Compactness: 17 Elongatedness: 1275 Euler Number: 1

S7: Size: 6593 Perimeter: 406 Moment: 14570,-10910 Compactness: 25 Elongatedness: 1418 Euler Number: 1

S8: Size: 6892 Perimeter: 518 Moment: 13925,-10437 Compactness: 38 Elongatedness: 1523 Euler Number: 1


Some interesting things to note is the variation of the features among the different sample objects. We can see that some things differ by a factor of 10 (Compactness) but other feature differ by the thousands (Size). These observations will be useful when matching objects.


For the matching equation I chose to use a weighted distance function using 5 dimensions.


i = sqrt(pow(this->moment.x - o.moment.x, 2) / 10//

+ pow(this->moment.y - o.moment.y, 2) / 10//*1.5 //

+ pow(this-> compactness - o.compactness, 2) * 1000//

+ pow(this-> elongatedness - o.elongatedness, 2) * 10 //

+ pow(this-> euler_number - o.euler_number, 2) * 1000000);



Each factor is scaled so that the average variation will be around 1000 among different objects. The euler number must be the same (in a undistorted image) for objects of the same type, therefor the euler number should dominate the equation, and is scaled to be magnitudes larger then the other features. This will ensure one feature doesn't dominate the equation. Next we look at the distance between the sample object and various objects in the text image.





TEST IMAGE 2 OBJECT DATA

[T1] Size: 6582 Perimeter: 486 Moment: 14810,-11085 Compactness: 35 Elongatedness: 1290 Euler Number: 1

[T2] Size: 6881 Perimeter: 492 Moment: 13982,-10584 Compactness: 35 Elongatedness: 1567 Euler Number: 1

[T3] Size: 6579 Perimeter: 394 Moment: 14387,-11072 Compactness: 23 Elongatedness: 1440 Euler Number: 1

[T4] Size: 6181 Perimeter: 310 Moment: 15444,-11657 Compactness: 15 Elongatedness: 1263 Euler Number: 1

[T5] Size: 9683 Perimeter: 444 Moment: 9967,-7341 Compactness: 20 Elongatedness: 1034 Euler Number: 0

[T6] Size: 4749 Perimeter: 264 Moment: 20328,-15185 Compactness: 14 Elongatedness: 1000 Euler Number: 1

[T7] Size: 6164 Perimeter: 312 Moment: 15683,-11535 Compactness: 15 Elongatedness: 1564 Euler Number: 1


[T1] S0(1999) S1(1099) S2(2445) S3(2650) S4(2396) S5(252) S6(625) S7(522) S8(819) 

Object 1 in test image 2 is training object 6. <252>

[T2] S0(1270) S1(861) S2(3126) S3(2800) S4(2612) S5(840) S6(1220) S7(605) S8(175) 

Object 2 in test image 2 is training object 9. <175>

[T3] S0(1475) S1(621) S2(2689) S3(2656) S4(2471) S5(619) S6(668) S7(121) S8(596) 

Object 3 in test image 2 is training object 8. <121>

[T4] S0(1999) S1(953) S2(2081) S3(2767) S4(2557) S5(850) S6(78) S7(687) S8(1258) 

Object 4 in test image 2 is training object 7. <78>

[T5] S0(3580) S1(2979) S2(4236) S3(1146) S4(44) S5(2196) S6(2527) S7(2427) S8(2498) 

Object 5 in test image 2 is training object 5. <44>

[T6] S0(3469) S1(2578) S2(34) S3(4573) S4(4263) S5(2694) S6(2108) S7(2647) S8(3108) 

Object 6 in test image 2 is training object 3. <34>

[T7] S0(1056) S1(65) S2(2585) S3(3185) S4(2999) S5(1198) S6(919) S7(689) S8(987) 

Object 7 in test image 2 is training object 2. <65>



Comments