1
# -*- coding: utf-8 -*-
2
#########################################################################################################################################
4
# MyNode By Bertrand NOUVEL
5
# 2009 CNRS Postdoctorate JFLI
7
# (c) All rights reserved
8
# ###############################################
10
################################################################################################################################################################################
12
################################################################################################################################################################################
19
from pycvf.core import genericnode
20
from pycvf.datatypes import generic
21
from pycvfext.image.datatypes import image
22
import numpy,scipy,scipy.ndimage
23
from pycvfext.image.nodes.harris import harris, harris_smooth
25
def showkkp(im,nb=100, *args,**kwargs):
26
ags=scipy.argsort(harris(im,*args,**kwargs).ravel())[-nb:]
27
im=im[:,:,numpy.newaxis].repeat(3,axis=2)
30
y,x=p//im.shape[1],p%im.shape[1]
31
im[max(0,y-1):y+1,max(0,x-1):x+1,0]=1
32
im[max(0,y-1):y+1,max(0,x-1):x+1,1]=0
33
im[max(0,y-1):y+1,max(0,x-1):x+1,2]=0
36
class Node(genericnode.Node):
37
def input_datatype(self,x):
38
assert(isinstance(x,image.Datatype()) or issubclass(x,image.Datatype()))
39
return image.Datatype()
40
def output_datatype(self,x):
41
return generic.Datatype
42
def init_model(self,nb=100,variant="",*args,**kwargs):
43
self.processline='src|harris'
44
f=eval("harris"+variant)
45
self.context['harris']=lambda x:map(lambda p:(p//x.shape[1],p%x.shape[1],2) ,scipy.argsort(numpy.abs(f(x,*args,**kwargs)).ravel())[-nb:])