public static List <NeuronBodyMask> GetNeuronBodyMasks(List <VectorOfPoint> input) { List <NeuronBodyMask> result = new List <NeuronBodyMask>(); NeuronBodyMask tmp_mask = new NeuronBodyMask(); Rectangle R = new Rectangle(); Image <Gray, Byte> maskImg = new Image <Gray, Byte>(1, 1, new Gray(0)); Point C = new Point(); VectorOfVectorOfPoint tmp_vvop = new VectorOfVectorOfPoint(); MCvMoments moments = new MCvMoments(); for (int i = 0; i < input.Count; i++) { R = CvInvoke.BoundingRectangle(input[i]); maskImg = new Image <Gray, byte>(184, 140, new Gray(0)); tmp_vvop = new VectorOfVectorOfPoint(); tmp_vvop.Push(input[i]); CvInvoke.DrawContours(maskImg, tmp_vvop, -1, new MCvScalar(255), -1, LineType.EightConnected); moments = CvInvoke.Moments(input[i]); C = new Point((int)(moments.M10 / moments.M00), (int)(moments.M01 / moments.M00)); //maskImg.Draw(new Point[] { C }, new Gray(100), 1); tmp_mask = new NeuronBodyMask(R, maskImg, C); result.Add(tmp_mask); } return(result); }
private void BTN_Prev_Click(object sender, EventArgs e) { if (NBM_id >= 0) { NBM_id--; } CurNBM = NBM[NBM_id]; }
private void BTN_Next_Click(object sender, EventArgs e) { if (NBM_id < NBM.Count) { NBM_id++; } CurNBM = NBM[NBM_id]; }