Skip to content

Programming641/computer_vision_algorithm3

Repository files navigation

computer_vision_algorithm3

finding shapes based on the appearance change. my first attempt to analyze pictures at low level

Operating environment

Windows 10

Python 3.9.5 pillow 8.2.0

powershell 7.4.2

Note

Please note that I am not using any conventional computer vision algorithm! algorithm are entirely created by me! The advantages of my algorithm are straightforward and intuitive, because for one, I am not using heavy mathmatics.

execute the following and see how it works for yourself!!!

Caution: image format must NOT be JPG!!! JPG does not work! Use PNG instead.

recent update: this is still work in progress.

run sample video

just run the powershell script

./execute_scripts.ps1

when script asks for directory. input videos/street3/resized

at the another prumpt, min1

when execute_scripts.ps1 finishes. run

py recreate_shapes/trd_stage/obj_shapes.py

go to

shapes\videos\street3\resized\min1\trd_stage\obj_shapes\objects1

introducing algorithms

py  algorithms/fundamental/putpix_into_clgrp.py 

original

1

1

edge detection

find_edges.py

examples

-executing on the original produces such great results!

1 leaf_mov_orig1clrgrp_70_70resized

1 sea_ride_orig1clrgrp_70_70resized

1 street_orig1clrgrp_70_70resized

Repeating pattern shapes

Instructions

I'll update on this later on.

Execution Results examples

Original Image

dog dog_clr_grp

147 967 2900 17614 19007 22122 28743

Combine repeating pattern shapes

combine_rpt_ptn_shapes.py

great result but big disadvantage is very very slow!!!!

I'll work on it to improve its speed.

1

764 1085

Video Analysis

the video analysis is all about finding the same shape between frames! sounds boring and tiring which is it is... but I believe computer vision for video is all about that!

Requirement

  • You need frames from video

At least two consecutive frames are needed.

you can use ffmpeg to get frames from the video

running example

example video

street6.mp4

frames of video

frames.mp4

example of video analysis results. just very few example matches of about 200 to 250 matches. I checked every one of the entire matches and all were correct! but for this video only. video that I was previously working on was very difficult one and percentage of correct matches on that was about 97 to 99%. still very high but they have to be 100% because for example you don't want the part of the car to be a part of the wall.

matches.mp4

entire results video

https://www.youtube.com/watch?v=7xaMYHdiYwg

pixel change analysis between video frames ( usually between two consecutive frames from the same video )

running examples

original image1 original image2

1_clrgrp 2_clrgrp

taking difference between frames above

diff12result1 diff12result2

another example

birdflying1 birdflying2

birdflying1_clr_grp birdflying2_clr_grp

diff12result1 diff12result2

original image

1 2

analyzing image difference1-1

analyzing image difference2-1

analyzing image difference3-1

original image

1 2

analyzing image difference4-1

find_staying_Lshp_btwn_frames.py

this script finds large shapes ( shapes with more than 50 pixels ) that did not move to another locations but stayed or moved a little in the next frame.

execution examples

original images

24 25

putpix_into_clrgrp.py --minimized colors version--

24 25

the results are perfect! works 100%!

find_staying_Lshp_btwn_frames

find_staying_Lshp_wo_pixch_btwn_frames.py

this is similar to find_staying_Lshp_btwn_frames.py but what is different is that this finds large shapes even if lots of pixel changes occurred.

execution examples

original images

10 11

10 11

find_staying_Lshp_wo_pixch_btwn_frames

find_internal_s_pixc_shapes.py

this script finds small pixels shapes that entirely surrounded by the one large shape. entirely surronded by one large shape means that they are internal shapes within the one large shape.

internal shapes1

internal shapes2

example

original

24 24

50934 73989 101926 101932 102222

execute recreate_internal_s_pixc_shapes.py to see the results

algorithms/pixch/find_consecutive_sty_pixch_shapes.py

required scripts

  • algorithms/pixch/find_staying_shapes.py
  • algorithms/pixch/verify_staying_shapes.py

無題

other algorithms result look like the above but they find different shapes.

Note

this is not the end of the project! Now, I am getting closer to first milestone of object detection!

if you like this project, please consider supporting me by sponsoring this project or hire me so I can work on this project for you!

About

finding shapes based on the appearance change. my first attempt to analyze pictures at low level

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published