//以前 //02_090702150918-0001.jpg -->大图片 //02_090702152518-0006-0000.jpg--> 小图片 //现在 //02_090807144104343.jpg-->大图片 //02_090807144104343-0000.jpg-->小图片 private void bestPicListView_ItemActivate(object sender, System.EventArgs e) { string filePath = this.bestPicListView.FocusedItem.Tag as string; //show modify icon if (File.Exists(filePath)) { this.pictureBox1.Image = Image.FromFile(filePath); } //detail infomation ImageDetail imgInfo = ImageDetail.FromPath(filePath); string captureLoc = string.Format("抓拍地点: {0}", imgInfo.FromCamera); this.labelCaptureLoc.Text = captureLoc; string captureTime = string.Format("抓拍时间: {0}", imgInfo.CaptureTime); this.labelCaptureTime.Text = captureTime; string bigImgPath = FileSystemStorage.BigImgPathForFace(imgInfo); this.pictureBoxWholeImg.Image = Image.FromFile(bigImgPath); }
private void SaveSelectedImage() { if ((this.bestPicListView.Items.Count <= 0) || (this.bestPicListView.FocusedItem == null)) { return; } string filePath = this.bestPicListView.FocusedItem.Tag as string; if (File.Exists(filePath)) { this.pictureBox1.Image = Image.FromFile(filePath); } ImageDetail imgInfo = ImageDetail.FromPath(filePath); string bigImgPath = FileSystemStorage.BigImgPathForFace(imgInfo); using (SaveFileDialog saveDialog = new SaveFileDialog()) { saveDialog.RestoreDirectory = true; saveDialog.Filter = "Jpeg 文件|*.jpg"; //saveDialog.FileName = filePath.Substring(filePath.Length - 27, 27); string fileName = Path.GetFileName(filePath); saveDialog.FileName = fileName; if (saveDialog.ShowDialog() == DialogResult.OK) { if (pictureBox1.Image != null) { string path = saveDialog.FileName; pictureBox1.Image.Save(path); path = path.Replace(fileName, Path.GetFileName(bigImgPath)); pictureBoxWholeImg.Image.Save(path); } } } }
unsafe ImageDetail[] SaveImage(Target[] targets) { IList <ImageDetail> imgs = new List <ImageDetail>(); foreach (Target t in targets) { Frame frame = t.BaseFrame; DateTime dt = DateTime.FromBinary(frame.timeStamp); for (int j = 0; j < t.FaceCount; ++j) { IntPtr * f = ((IntPtr *)(t.FaceData)) + j; IplImage aFace = new IplImage(*f); aFace.IsEnabledDispose = false; string facePath = FileSystemStorage.GetFacePath(frame, dt, j); aFace.SaveImage(facePath); imgs.Add(ImageDetail.FromPath(facePath)); } } ImageDetail[] details = new ImageDetail[imgs.Count]; imgs.CopyTo(details, 0); return(details); }
private void SaveSelectedImage() { if ((this.facesListView.Items.Count <= 0) || (this.facesListView.FocusedItem == null)) { return; } ImagePair ip = this.facesListView.FocusedItem.Tag as ImagePair; ImageDetail imgInfo = ImageDetail.FromPath(ip.FacePath); string bigImgPath = ip.BigImagePath; using (SaveFileDialog saveDialog = new SaveFileDialog()) { saveDialog.RestoreDirectory = true; saveDialog.Filter = "Jpeg 文件|*.jpg"; //saveDialog.FileName = filePath.Substring(filePath.Length - 27, 27); string fileName = Path.GetFileName(ip.FacePath); saveDialog.FileName = fileName; if (saveDialog.ShowDialog() == DialogResult.OK) { if (facePictureBox.Image != null) { string path = saveDialog.FileName; facePictureBox.Image.Save(path); path = path.Replace(fileName, Path.GetFileName(bigImgPath)); wholeImage.Image.Save(path); } } } }
public void SelectedImageChanged() { ImageDetail img = this.screen.SelectedImage; if (img != null && !string.IsNullOrEmpty(img.Path)) { string bigPicPathName = FileSystemStorage.BigImgPathFor(img); ImageDetail bigImageDetail = ImageDetail.FromPath(bigPicPathName); this.screen.BigImage = bigImageDetail; } }
public void SelectedImageChanged() { ImageDetail img = this.screen.SelectedImage; if (img != null && !string.IsNullOrEmpty(img.Path)) { string bigPicPathName = BuildFolderPath(img); ImageDetail bigImageDetail = ImageDetail.FromPath(bigPicPathName); this.screen.BigImage = bigImageDetail; } }
public void ClassifyImagesTest() { string[] files = System.IO.Directory.GetFiles(@"d:\20090505"); ImageDetail[] images = new ImageDetail[10]; for (int i = 0; i < images.Length; i++) { ImageDetail d = ImageDetail.FromPath(files[i]); images[i] = d; } ImageClassifier.ClassifyImages(images); }
void File_Created(object sender, FileSystemEventArgs e) { if (e.ChangeType == WatcherChangeTypes.Created) { ImageDetail img = ImageDetail.FromPath(e.FullPath); System.Diagnostics.Debug.WriteLine("file created"); System.Diagnostics.Debug.WriteLine(e.FullPath); InitCameraQueue(img.FromCamera); FireUploadEvent(img); } }
private void ShowPic() { if (this.squareListView1.SelectedCell == null) { return; } string p = this.squareListView1.SelectedCell.Path; if (p == null) { return; } this.ShowDetailPic(ImageDetail.FromPath(p)); }
public void ImageDetailConstructorTest() { string pathName = @"c:\abc\02_090426154606-0011.jpg"; // TODO: Initialize to an appropriate value ImageDetail target = ImageDetail.FromPath(pathName); Assert.AreEqual(2, target.FromCamera); Assert.AreEqual(2009, target.CaptureTime.Year); Assert.AreEqual(4, target.CaptureTime.Month); Assert.AreEqual(26, target.CaptureTime.Day); Assert.AreEqual(15, target.CaptureTime.Hour); Assert.AreEqual(46, target.CaptureTime.Minute); Assert.AreEqual(6, target.CaptureTime.Second); Assert.AreEqual(@"c:\abc", target.ContainedBy); Assert.AreEqual(@"02_090426154606-0011.jpg", target.Name); Assert.AreEqual(@"c:\abc\02_090426154606-0011.jpg", target.Path); }
private void toolStripButtonPlayVideo_Click(object sender, EventArgs e) { if (SearchProxy == null) { return; } if (this.bestPicListView.SelectedItems.Count != 1) { return; } ImagePair ip = this.bestPicListView.SelectedItems[0].Tag as ImagePair; ImageDetail imgInfo = ImageDetail.FromPath(ip.FacePath); string video = null; try { video = SearchProxy.VideoFilePathRecordedAt(imgInfo.CaptureTime, imgInfo.FromCamera); } catch (System.ServiceModel.CommunicationException) { MessageBox.Show("通讯错误, 请重试"); IChannel ch = SearchProxy as IChannel; if (ch.State == CommunicationState.Faulted) { this.CreateProxy(); } return; } if (string.IsNullOrEmpty(video)) { MessageBox.Show("未找到相关视频"); return; } this.ReceiveVideoStream(); StreamProxy.StreamVideo(video); isPlaying = true; }
private ImageDetail[] BuildIconImages(string destFolder, ImageDetail[] bigImgs, string iconFilesString) { string[] iconFiles = iconFilesString.Split(new char[] { '\t' }, StringSplitOptions.RemoveEmptyEntries); IDictionary <int, IList <string> > iconGroup = new Dictionary <int, IList <string> >(); //分组 for (int i = 0; i < iconFiles.Length; i += 2) { int idxOfBigPic = int.Parse(iconFiles[i + 1]); if (!iconGroup.ContainsKey(idxOfBigPic)) { iconGroup.Add(idxOfBigPic, new List <string>()); } iconGroup[idxOfBigPic].Add(iconFiles[i]); } IList <ImageDetail> returnImgs = new List <ImageDetail>(); foreach (var iconSubGroup in iconGroup) { for (int i = 0; i < iconSubGroup.Value.Count; i++) { int idx = iconSubGroup.Key; string bigPicPath = bigImgs[idx].Path; string bigpicExtension = Path.GetExtension(bigPicPath); string bigPicNameWithoutExtention = Path.GetFileNameWithoutExtension(bigPicPath); string iconFileName = string.Format("{0}-{1:d4}{2}", bigPicNameWithoutExtention, i, bigpicExtension); string iconFilePath = Path.Combine(destFolder, iconFileName); //rename file string origIconFilePath = Path.Combine(destFolder, iconSubGroup.Value[i]); File.Move(origIconFilePath, iconFilePath); returnImgs.Add(ImageDetail.FromPath(iconFilePath)); } } ImageDetail[] returnImgsArray = new ImageDetail[returnImgs.Count]; returnImgs.CopyTo(returnImgsArray, 0); return(returnImgsArray); }
//以前 //02_090702150918-0001.jpg -->大图片 //02_090702152518-0006-0000.jpg--> 小图片 //现在 //02_090807144104343.jpg-->大图片 //02_090807144104343-0000.jpg-->小图片 private void bestPicListView_ItemActivate(object sender, System.EventArgs e) { ImagePair ip = this.bestPicListView.FocusedItem.Tag as ImagePair; this.pictureBoxFace.Image = ip.Face; //detail infomation ImageDetail imgInfo = ImageDetail.FromPath(ip.FacePath); string captureLoc = string.Format("抓拍地点: {0}", imgInfo.FromCamera); this.labelCaptureLoc.Text = captureLoc; string captureTime = string.Format("抓拍时间: {0}", imgInfo.CaptureTime); this.labelCaptureTime.Text = captureTime; this.pictureBoxWholeImg.Image = ip.BigImage; }
private void playRelateVideo_Click(object sender, EventArgs e) { Cell c = this.squareListView1.SelectedCell; if (c == null || c.Path == null) { return; } ImageDetail imgInfo = ImageDetail.FromPath(c.Path); string[] videos = FileSystemStorage.FindVideos(imgInfo); if (videos.Length == 0) { MessageBox.Show(this, "没有找到相关视频", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } VideoPlayer.PlayVideosAsync(videos); }
private void toolStripButtonPlayVideo_Click(object sender, EventArgs e) { if (this.bestPicListView.SelectedItems.Count != 1) { return; } string imgPath = this.bestPicListView.SelectedItems[0].Tag as string; ImageDetail imgInfo = ImageDetail.FromPath(imgPath); string[] videos = FileSystemStorage.VideoFilesOfImage(imgInfo); if (videos.Length == 0) { MessageBox.Show("未找到相关视频"); return; } VideoPlayer.PlayVideosAsync(videos); }
ImageDetail[] SaveImage(Target[] targets) { IList <ImageDetail> imgs = new List <ImageDetail>(); foreach (Target t in targets) { Frame frame = t.BaseFrame; for (int j = 0; j < t.Faces.Length; ++j) { string facePath = FileSystemStorage.PathForFaceImage(frame, j); t.Faces[j].SaveImage(facePath); imgs.Add(ImageDetail.FromPath(facePath)); } } ImageDetail[] details = new ImageDetail[imgs.Count]; imgs.CopyTo(details, 0); return(details); }
private void playRelateVideo_Click(object sender, EventArgs e) { Cell c = this.squareListView1.SelectedCell; if (c == null || c.Path == null) { return; } ImageDetail imgInfo = ImageDetail.FromPath(c.Path); string root = Path.Combine(Properties.Settings.Default.OutputPath, imgInfo.FromCamera.ToString("D2")); string[] videos = VideoSearch.FindVideos(root, imgInfo); if (videos.Length == 0) { MessageBox.Show(this, "没有找到相关视频", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (videoPlayerPath == null) { MessageBox.Show(this, "请安装相应播放器", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } StringBuilder sb = new StringBuilder(); foreach (var file in videos) { sb.Append(file); sb.Append(' '); } sb.Append(@"vlc://quit"); sb.Append(' '); Process.Start(videoPlayerPath, sb.ToString()); }
private void picList_DoubleClick(object sender, EventArgs e) { //MessageBox.Show("图片路径:"+this.picList.FocusedItem.Tag.ToString()); ShowDetailPic(ImageDetail.FromPath(this.picList.FocusedItem.Tag.ToString())); }