Delphi:如何以Facebook的方式标记照片 [英] Delphi: How to tag photos the way facebook does

查看:148
本文介绍了Delphi:如何以Facebook的方式标记照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法来以Delphi桌面应用程序的方式来标记Facebook的方式。

I need a way to tag photos in a Delphi desktop application the way Facebook does it.

这包括一些方法可以轻松地将标签添加到人物上,然后将鼠标悬停在照片中的人物上显示标签。

That includes some way to easily add the tags over the people, and then hovering the mouse over the person in the photo to show the tag.

答案中的两个建议:用于面部识别和标记的Delphi组件不解决这个问题。

The two suggestions in the answer given to: "Delphi Components for Face Identification and Tagging" don't solve this.

但我不知道从哪里开始,一直无法找到想法在网上如何做到这一点。 Facebook如何做?或者也许有一个Delphi组件允许它。

But I have no idea where to start, and have been unable to find ideas on the web on how to do this. How does Facebook do it? Or maybe there's a component for Delphi that will allow it.

尝试实现类似Facebook的标签是最好的方法?

What would be the best way to try to implement Facebook-like tagging?

ps这是Facebook的一些API定义: http://wiki.developers。 facebook.com/index.php/Photos.addTag

p.s. This is some of Facebook's API definition for this: http://wiki.developers.facebook.com/index.php/Photos.addTag

这是一个Java程序,实现我在Delphi应用程序中执行的面部标记功能: fb-photo-uploader

Here is a Java program that implements the face tagging functionality that I want to do in my Delphi app: fb-photo-uploader

推荐答案

您引用的API的关键参数是图片ID,坐标和标签。标签可以是Facebook用户的用户ID,也可以是自由格式的文本(对于标记的主题不是Facebook用户的情况)。 Facebook使用一个坐标,因为它使用固定大小的区域来表示标记区域;您的想法是,您点击一个人的脸的中心,Facebook只是存储那一点。

The key parameters of the API you cited are the picture ID, the coordinates, and the tag. The tag can be either the user ID of a Facebook user, or it can be free-form text (for the case when the tagged subject is not a Facebook user). Facebook uses just one coordinate because it uses fixed-size regions to denote a tagged area; the idea is that you click on the center of a person's face, and Facebook just stores that point.

如果您在 TImage中显示图片控制(这是显而易见的首选),您可以使用 OnMouseDown OnMouseUp 事件。 ( OnClick 事件更简单,但不告诉你坐标。)一旦你获得了一个点,就提示标签贴在那边。您可以使用预定的标签,如Facebook的用户ID,或只使用普通文本,或使用您自己设计的东西。用于表示标签值的问题与您迄今为止所问的任何其他问题是正交的。

If you display a picture in a TImage control (that's the obvious first choice, after all), you can detect mouse clicks with the OnMouseDown and OnMouseUp events. (The OnClick event is simpler, but doesn't tell you the coordinates.) Once you've acquired a point, prompt for a label to accompany that point. You can use predetermined labels, like Facebook's user IDs, or just use ordinary text, or use something of your own devising. The question of what you use to represent a tag value is orthogonal to whatever other questions you've asked so far.

Facebook的照片标签的另一半是移动图像上的鼠标在图像上显示标签文本,并将鼠标移到标签下方突出显示相关联的区域。处理 OnMouseMove 事件,并编写一些代码以适当地显示或隐藏标签和形状。如果您使用 TLabel TShape ,您可能甚至不必修改图像,但显示这些控件在图像可能会影响图像的进一步 OnMouseMove 事件。尝试一些实验不应该花太长时间,看看有什么有用的。

The other half of Facebook's photo tagging is that moving the mouse over the image displays the tag text over the image, and moving the mouse over the labels below highlight the associated regions. Handle OnMouseMove events and write some code to display or hide labels and shapes as appropriate. If you use TLabel and TShape, you might not even have to modify the image, but showing those controls on top of the image might interfere with further OnMouseMove events for the image. It shouldn't take too long to try some experiments and see what works for you.

这篇关于Delphi:如何以Facebook的方式标记照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆