情報詳細Q:ラインセンサーのキャリブレーションをしたいのですが、キャリブレーションプレートを設置できないような構造です。何か方法はありますか?A:等間隔で印刷された縞模様を撮影できることが条件ですが可能です。2つの方法を紹介します。1つ目は、edges_sub_pixで検出したエッジに対して、等間隔で引いた線の距離との差分を取得してX方向への歪量を計算する手法です。*中心部のXLDの距離CenterIndex:=|Column|/2+1CenterCol:=Column[CenterIndex]CenterColpuls1:=Column[CenterIndex+1]DiffCol:=CenterColpuls1-CenterCol*補正の計算式tuple_gen_sequence (-DiffCol*(CenterIndex), DiffCol*(CenterIndex-2), DiffCol, Sequence)RectX:=Sequence+CenterColgen_empty_obj (Concats)for i:= 0 to |RectX|-1 by 1 gen_region_hline (Regions, 0, RectX[i]) concat_obj (Concats, Regions, Concats)endfor*画像座標と補正座標の差DiffX:=Column-RectX*関数化create_funct_1d_array (DiffX, Function)smooth_funct_1d_gauss (Function, 1, SmoothedFunction)*画像の幅分の点列データにするsample_funct_1d (SmoothedFunction, 0, |DiffX|, (1.0*|DiffX|)/(Width*1.0), 'constant', SampledFunction)*個数の整合性が合わない場合は前半部分を切り取る(Functionの時点で前半部分に0,1,0という値が出るためここでカットしている)DiffNum:=|SampledFunction|-Widthif(DiffNum>0) for i:=0 to DiffNum-1 by 1 tuple_remove (SampledFunction, [0], SampledFunction) endforendif*X画像生成(Colの座標値が輝度値になる)gen_image_surface_first_order (ImageX, 'real', 0, 1, Width/2, Height/2, Width/2, Width, Height)*1ラインの画像を作り、Xの差分値を輝度値として入力gen_image_const (Image1, 'real', Width, 1)gen_region_line (RegionLines, 0, Width, 0, 0)get_region_points (RegionLines, Rows, Columns)set_grayval (Image1, Rows, Columns, SampledFunction)*1ラインの画像を画像の高さ分拡張するzoom_image_size (Image1, ImageZoom, Width, Height, 'constant')2つ目の手法は、局所変形マッチングを適用する手法です。* 理想となる形状をモデルとして登録create_local_deformable_model (ModelImage, 'auto', rad(-5), rad(10), 'auto', 1, 1, 'auto', 1, 1, 'auto', 'none', 'use_polarity', 'auto', 'auto', [], [], ModelID)* 歪みがある形状read_image (ImageBefore, '5Lines')* 移動させるベクトルを理想とのマッチングにより計算する 今回画像が小さいため、ピラミッドレベルは1だが、画像サイズが大きい場合は変えることfind_local_deformable_model (ImageBefore, ImageRectified, VectorField, DeformedContours, ModelID, rad(-5), rad(10), 1, 1, 0.8, 1.2, 0.5, 1, 1, 1, 0.9, ['image_rectified','vector_field','deformed_contours'], ['deformation_smoothness','expand_border','subpixel'], [3,0,1], Score, Row, Column) 添付ファイルlocal_Deformable.zipタイトルキャリブレーションプレートを使わないラインセンサーのキャリブレーションURL 名キャリブレーションプレートを使わないラインセンサーのキャリブレーション公開状況公開済み検証状況公開済み