Info
此问题已关闭。 请重新打开它进行编辑或回答。
Hi, in binary image i want to divide 'n' number frames into n/2,then in both n/2 frames, i need to calculate number of white pixels,check if that counts are larger or smaller than 'n' white pixels count.if greater again follow the same steps.
2 次查看(过去 30 天)
显示 更早的评论
its like divide and conquer strategy,if suppose the second 'n/2' white pixel count is greater then divide it into two half and so on.Otherwise find which frame contain maximum white pixels and save it separately in array. please help me sir using matlab code
16 个评论
Walter Roberson
2015-8-8
Take the example image of ones(6,10) and n = 3, and show us how you would want that to be divided up.
kaavya subramani
2015-8-8
编辑:Walter Roberson
2015-8-8
- suppose video contains 100 frames.
- find count of '1'(white pixel)in all 100 frames.
- split 100 frames into 50 and 50.
- calculate '1s' in both 50 and 50 frames.
- if number or count of '1s'in first 50frames are lesser than number of '1s' in 100 frames,then find a frame which contain maximum '1s'from that 1st 50 frames and store it separately,else again divide it and compare with first 50 frames.
- likewise follow for 2nd 50 frames and so on
Walter Roberson
2015-8-8
The count of 1s in the first 50 frames is always going to be less than the number of 1s in all 100 frames -- unless, that is, that the last 50 frames are all completely 0 in which case the count of the first 50 would exactly equal the count for all 100.
Do you ever divide further than into groups of 25? If you do then you have the problem that 25 is not evenly divisible by 2: do you want to divide into half-frames? If you do then you still have a problem if the number of pixels in the frame is odd, such as for a 101 x 137 frame.
kaavya subramani
2015-8-8
I understood what you commented sir 1.number of 1s in 100frames/ 2 or 4 and then compare with result of 50 frames.if greater then i want to divide that number of 1s in 50frames/ 2 or 4. 2.if suppose 25 frames use ceil or floor. 3. i changed my video to have even number of pixels as my initial step
Walter Roberson
2015-8-8
If I understand correctly, you want your routine to take as input a group of frames. It should divide the group into two halves. The half that has more than half of the total white pixels should be sub-divided, and the half that has the most pixels out of that should be selected. But should that quarter then be sub-divided as well? Does the process keep going until you are at the point where the two halves have exactly the same number of white pixels or the point where you are down to one frame?
The collection to pass in should be either a struct array or a cell array for the following code to work
function split_collection = splitwhite(frame_collection)
if length(frame_collection) == 1
split_collection = frame_collection; %got down to one frame
return
end
firsthalf = frame_collection(1:end/2);
secondhalf = frame_collection(end/2+1:end);
first_white = number_of_white(firsthalf);
second_white = number_of_white(secondhalf);
if first_white > second_white
split_collection = {splitwhite(firsthalf) secondhalf};
elsif first_white < second_white
split_collection - {firsthalf splitwhite(secondhalf)};
else
split_collection = frame_collection; %no split if the two halves are the same
end
end
kaavya subramani
2015-8-8
The process should continue until we get white pixels count less than its parent.i attached one example diagram sir,please see it
Walter Roberson
2015-8-8
Let P = A + B . If A > P/2 then A > (A+B)/2 so A > A/2 + B/2 so (A-A/2) > B/2 so A/2 > B/2 so A > B.
Therefore the test for the first half being more than half of the total group is the same as checking to see if the first half is more than the second half.
Side note: old-time volunteers who have not had enough sleep tend to remember http://boards.straightdope.com/sdmb/showthread.php?t=359127
Image Analyst
2015-8-10
编辑:Image Analyst
2015-8-10
Are these video frames you're talking about, or subimages of a single image? Are you trying to do quadtree decomposition? http://www.mathworks.com/help/images/ref/qtdecomp.html?s_tid=srchtitle
Walter Roberson
2015-8-10
What does the "this" refers to that you are asking about?
My first line is a proof that testing that the first half holds more than half of the total is the same thing as testing that the first half holds more than the second half.
My final line was a reminder that volunteers sleep on their own schedule, not at times arranged to be convenient for you. The volunteers in North America who regularly answer questions are in GMT-4, GMT-5, and GMT-6
此问题已关闭。
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
