RANSAC algorithm to use the vanishing point detection

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
skylin008
Posts: 54
Joined: Wed Mar 11, 2015 6:21 am

RANSAC algorithm to use the vanishing point detection

Post by skylin008 » Tue Aug 29, 2017 7:40 am

Hello,every one! Now I using the openmv3 board with stm32f7 mcu, I need to be used the RANSAC algorithm to detection the vanishing point.Follow the python script:

Code: Select all

import random

def run_ransac(data, estimate, is_inlier, sample_size, goal_inliers, max_iterations, stop_at_goal=True, random_seed=None):
	best_ic = 0
	best_model = None
	random.seed(random_seed)
	for i in xrange(max_iterations):
		s = random.sample(data, int(sample_size))
		m = estimate(s)
		ic = 0
		for j in xrange(len(data)):
			if is_inlier(m, data[j]):
				ic += 1

		print s
		print 'estimate:', m,
		print '# inliers:', ic

		if ic > best_ic:
			best_ic = ic
			best_model = m
			if ic > goal_inliers and stop_at_goal:
				break
	print 'took iterations:', i+1, 'best model:', best_model, 'explains:', best_ic
return best_model, best_ic

How to modified to suit the mpy platform.Thanks!

User avatar
deshipu
Posts: 1346
Joined: Thu May 28, 2015 5:54 pm

Re: RANSAC algorithm to use the vanishing point detection

Post by deshipu » Tue Aug 29, 2017 8:57 am

I think you will get much better answers at http://openmv.io forum.

Post Reply