Tuesday, 31 December 2013

3D scanning with photographs

3D scanning really small things with photographs



While working on one of my many diversions (projects) I needed a 3D model of a very small component - Sharp's GP2S60 photointerruptor.

A quick look at the above PDF link will tell you that this is a very small device - 3.2 x 1.7 x 1.1 mm!

I followed Happy Robot's guide to create a 3D model for Analog Devices ADMP441 mems microphone (now sold to Invisense) for KiCad but the prospect of modeling Sharp's device was daunting.

Then I happened across www.my3dscanner.com and my spirits improved.

Just take some photos, upload them and voilà!

Just take some photos

Sounds easy, and after about 10 hours setting things up, well, it was pretty easy.

Equipment

A PC, a Raspberry Pi, a Raspberry Pi camera, and (optional) a wireless router in bridge mode

I'd previously modified the Raspberry Pi camera to take close-up pictures so I thought I'd try that.

Viewing the video output can be troublesome over WiFi as it has a more limited bandwidth, but it depends on your wifi cards/dongles and your wifi router.

One solution I tried was to use a TP-Links WR740N router in bridge mode and connect the Raspberry Pi and my PC to it, allowing wired ethernet speeds between them, with WiFi speed internet access for both.

Of course I had to reset the router to factory defaults first because I hadn't used it since UPC provided their WiFi modem, and I eventually discovered I needed to update the firmware for bridging to work, and I needed to use the Raspberry Pi to do all this because I couldn't get my laptop to talk Wifi and wired networking at the same time as both routers were set up for 192.168.0.1.

Every time I have to mess around with networking I wish I hadn't, but I was determined, and it paid off.

The wired speeds were 3 times that of WiFi and the video quality was flawless.

Update: 2014-03-28 with the new video scripts wifi video streaming is perfectly acceptable. Maybe it was the router.

The rig

I need a workshop, I know

That's a garden floodlight, all glorious 500W were needed to mostly eliminate image noise as things are zoomed up. Plus I couldn't think of anywhere else to set things up where the floodlight could hang.

I took the Quick Set-Up for Accurate Industrial Quality Scanning as a starting point - my rig needed to be a lot smaller.

I didn't have a picture of an Apple, like the "Quality Scanning" guide had, and I knew that my turntable needed a small, matt, non-repeating image as a back-drop for the item to be scanned.

So I looked around and she caught my eye.

On the front page of the Evening Herald was a picture of Laura Whitmore which looked nice. I figured I'd be looking at the background to the components I was scanning a lot so I chose something I wouldn't tire of soon, or ever (blush).

I cut it into a circle and marked it at approximately every 15 degrees as per the guide.

I used some Pritt Stick to stick it to some card board, and sticky tape to stick a thumb tack to the back, pointy bit outward.

I had taken down a foam+paper 3D puzzle from the attic as my resolution to always-take-down-more-than-you-put-up required, so it was handy for sticking the thumb tack pointy-bit into and I had a turntable.

Laura Whitmore framing the part (I hope that's OK with you, Laura!)
I had set up an NFS share on my PC and mounted it with the 'Pi, so it could then save files right to my PCs hard disk.

To get the video preview I put the following into raspivid-server:

#!/bin/sh
while true; do
  raspivid -w 1280 -h 1024 -t 999999999 -fps 30 -b 5000000 -o - | nc -l -p 5001
done
...and ran it on the 'pi.

You can make the script executable with
chmod +x raspivid-server
so you can invoke it with
./raspivid-server
or forget making it executable and run
sh raspivid-server
The following goes into raspivid-client
#!/bin/sh
if test "$1" = ""; then
    h="192.168.0.15"
else
    h="$1"
fi
nc $h 5001 | mplayer -fps 40 -demuxer h264es -
and ran on the PC.

You can make the script executable with
chmod +x raspivid-client
so you can invoke it with
./raspivid-client 192.168.0.123
or forget making it executable and run
sh raspivid-client 192.168.0.123
The client needs to know the IP address of the server (the 'pi) - I configured the router to reserve one IP address for the wifi dongle on the 'pi, and put that as the default for the script.

For trying wired access or another 'pi, you can supply the 'pi's IP address on the command line.

Thanks to this post for how to do low latency streaming.

It seems to require moving your hand in front of the camera to flush some frames through and reduce the latency, which starts out awful: > 3 seconds delay.
After that the delay for me was less than 0.5 seconds!

After getting the 'Pi camera able to focus on really nearby things (the lens nearly fell out I had it unscrewed so much!) using the above scripts, I took a series of pictures with the "raspistill" program in time-lapse mode, of which this is the first:


I poked the turn-table with a piece of wire so that each shot was approximately a 15 degree rotation more/less than the one before, and was so chuffed I started disassembling the rig and putting things away.

It was then I remembered the guides warning about no shadows - d'oh!
I forgot to photograph the back - d'oh number two!

Things were a lot quicker the second time around but I had to use a milk carton to diffuse the light:
The results:


I converted the image sequences to video for your delectation:





 I got those pesky ffmpeg flags from here.
ffmpeg -r 10 -g 300 -i image-fr-%04d.jpg -vcodec mjpeg -qscale:v 1 image-fr.avi
ffmpeg -r 10 -g 300 -i image-bk-%04d.jpg -vcodec mjpeg -qscale:v 1 image-bk.avi
just remember to renumber the frames so they start at 0001 and increase by 1.

Results

I uploaded them to my3dscanner.com and a few days later I got a notification that the results were available for download - the delay was probably due to holidays.

Here are some pictures I took of them with Meshlab:



Now to figure out how to process them!

Tuesday, 2 April 2013

TP WR702N factory install web pages with translations

Factory install web pages

Expanded table of contents (left frame)

* 运行状态
* 设置向导
* 工作模式
* 网络参数
    * LAN口设置
* 无线设置
    * 基本设置
    * 无线安全设置
    * 无线MAC地址过滤
    * 无线高级设置
    * 主机状态
* DHCP服务器
    * DHCP服务
    * 客户端列表
    * 静态地址分配
* 系统工具
    * 诊断工具
    * 软件升级
    * 恢复出厂设置
    * 备份和载入配置
    * 重启路由器
    * 修改登录口令
    * 系统日志

更多TP-LINK产品,
请点击查看 >>

Expanded table of contents (left frame)

* Running state
* Setup Wizard
* Operating mode
* Network parameters
    * LAN port settings
* Wireless settings
    * Basic Settings
    * Wireless security settings
    * Wireless MAC address filtering
    * Wireless Advanced Settings
    * Host state
* DHCP server
    * DHCP service
    * Client list
    * Static address assignment
* System Tools
    * Diagnostic tool
    * Software upgrades
    * Restore the factory settings
    * Backup and load configuration
    * Restart router
    * Change Password
    * System log

TP-LINK products
Please click View >>

Running state

    版本信息

当前软件版本:   
4.18.85 Build 120530 Rel.56096n
当前硬件版本:   
WR702N 1.0 00000000


    LAN口状态

MAC 地址:   
14-E6-E4-EF-09-AC
IP地址:   
192.168.1.253
子网掩码:   
255.255.255.0


    无线状态

无线模式:    AP 模式
无线功能:    启用
SSID号:    TP-LINK_PocketAP_EF09AC
信 道:    自动(当前信道 6)
模 式:    11bgn mixed
频段带宽:    自动
MAC 地址:    14-E6-E4-EF-09-AC
WDS状态:    未开启


运行时间:   
0 天 01:10:56

Running state

Version information

Current software version:
4.18.85 Build 120530 Rel.56096n
Current hardware versions:
WR702N 1.0 00000000


LAN port status

MAC address:
14-E6-E4-EF-09-AC
IP address:
192.168.1.253
Subnet Mask:
255.255.255.0


Wireless Status

Wireless Mode: AP Mode
Wireless function: Enable
SSID No.: TP-LINK_PocketAP_EF09AC
Channel: Auto (channel 6)
Mode: 11bgn mixed
Band bandwidth: Automatic
MAC address: 14-E6-E4-EF-09-AC
WDS Status: Not open

Setup Wizard

    设置向导

本向导可设置上网所需的基本网络参数,请单击“下一步”继续。若要详细设置某项功能或参数,请点击左侧相关栏目。

Setup Wizard

The wizard to set the Internet basic network parameters, click "Next" to continue. To set up a function or parameters in detail, please click on the relevant part of the left side.

Wireless mode settings


    无线工作模式设置

AP:    接入点模式
Router:    无线路由模式
Repeater:    中继模式
Bridge:    桥接模式
Client:    客户端模式

Wireless mode settings


AP: Access Point Mode
Router: wireless routing mode
Repeater: relay mode
Bridge: Bridge Mode
Client: Client Mode

LAN port settings

    LAN口设置

本页设置LAN口的基本网络参数。
MAC地址:
IP地址:
子网掩码:

LAN port settings

This page to set basic network parameters of the LAN port.
MAC address:
IP address:
Subnet Mask:

Basic wireless network settings



    无线网络基本设置

AP 模式
SSID号:   
信道:   
模式:   
频段带宽:   
     开启无线功能
     开启SSID广播
开启WDS

Basic wireless network settings


AP mode
The SSID:
Channel:
Mode:
Band bandwidth:
Turn on the wireless function
Open the SSID broadcast
Open WDS

Wireless network security settings

无线网络安全设置

本页面设置路由器无线网络的安全认证选项。
安全提示:为保障网络安全,强烈推荐开启安全设置,并使用WPA-PSK/WPA2-PSK AES加密方法。

* 不开启无线安全

* WPA-PSK/WPA2-PSK
认证类型:
加密算法:
PSK密码:
(8-63个ASCII码字符或8-64个十六进制字符)
组密钥更新周期:
(单位为秒,最小值为30,不更新则为0)
WPA/WPA2
认证类型:
加密算法:
Radius服务器IP:
Radius端口: (1-65535,0表示默认端口:1812)
Radius密码:
组密钥更新周期:
(单位为秒,最小值为30,不更新则为0)
* WEP
认证类型:
WEP密钥格式:
密钥选择 WEP密钥 密钥类型
密钥 1:
密钥 2:
密钥 3:
密钥 4:

Wireless network security settings


This page is set up the wireless router network security authentication option.
Safety Tips: In order to ensure network security, it is strongly recommended to open the security settings and use WPA-PSK/WPA2-PSK AES encryption method.

* Do not turn on wireless security

* WPA-PSK/WPA2-PSK
Authentication Type:
Encryption algorithm:
PSK password:
 (8-63 ASCII characters or 8-64 hexadecimal characters)
Group key updates Cycle:
 (In units of seconds, and the minimum value is 30, not updated or 0)
* WPA/WPA2
Authentication Type:
Encryption algorithm:
Radius server IP:
Radius Port: (1-65535,0 of default port: 1812)
Radius Password:
Group key updates Cycle:
 (In units of seconds, and the minimum value is 30, not updated or 0)
* WEP
Authentication Type:
WEP key format:
Keys to select the WEP key key type
Key 1:
Key 2:
Key 3:
Key 4:

Wireless network MAC address filtering settings

无线网络MAC地址过滤设置

本页设置 MAC 地址过滤来控制计算机对本无线网络的访问。
MAC 地址过滤功能:已关闭
过滤规则
禁止 列表中生效的MAC地址访问本无线网络
允许 列表中生效的MAC地址访问本无线网络
ID MAC 地址 状态 描 述 编 辑

Wireless network MAC address filtering settings


This page set MAC address filtering to control access to the computer on the wireless network.
MAC address filtering: Closed
Filtering rules
* The MAC address of the entry into force of the ban list to access the wireless network
* Allow the MAC address of the entry into force of the list to access the wireless network
ID MAC address state description Edit

Wireless Advanced Settings

无线高级设置

传输功率:
Beacon时槽: (40-1000)
RTS时槽: (1-2346)
分片阈值: (256-2346)
DTIM阈值: (1-255)
开启 WMM
开启 Short GI
开启 AP隔离

Wireless Advanced Settings


Transmission power:
Beacon slots: (40-1000)
RTS time slot: (1-2346)
Fragmentation Threshold: (256-2346)
The DTIM threshold value: (1-255)
 Open WMM
 Open Short GI
 Open AP Isolation

Wireless Network host status

无线网络主机状态

本页显示连接到本无线网络的所有主机的基本信息
当前所连接的主机数:0
ID MAC地址 当前状态 接收数据包数 发送数据包数

Wireless Network host status


This page shows basic information to connect to the wireless network host.
Currently connected to the host:
ID MAC address the current state number of receive data packets the number of send packets

DHCP service

DHCP服务

本路由器内建的DHCP服务器能自动配置局域网中各计算机的TCP/IP协议。
DHCP服务器: 不启用 启用
地址池开始地址:
地址池结束地址:
地址租期: 分钟 (1~2880分钟,缺省为120分钟)
网关: (可选)
缺省域名: (可选)
主DNS服务器: (可选)
备用DNS服务器: (可选)

DHCP service

The router's built-in DHCP server to automatically configure each computer in the LAN TCP / IP protocol.
DHCP server: not enabled enabled
Address pool start address:
The end of the address pool address:
Address lease: minutes (1 ~ 2880 minutes, default is 120 minutes)
Gateway: (optional)
The default domain name: (optional)
Primary DNS server: (optional)
Alternate DNS server: (optional)

Client list

客户端列表

当前客户端列表为空


Client list


Current client list is empty

Static address assignment


静态地址分配

本页设置DHCP服务器的静态地址分配功能。

注意:添加、删除条目或对已有条目做任何更改,需重启本设备后才能生效。
ID MAC地址 IP地址 状 态 编 辑

Static address assignment


This page set static address assignment of DHCP server functionality.

Note: Add, delete an entry or make any changes to existing entries, you need to restart the device to take effect.
ID MAC address IP address edit state

Diagnostic tool

诊断工具

在本页面可以使用ping或者tracert,诊断路由器的连接状态。
参数设置
选择操作: Ping Tracert
IP 地址/域名:
Ping 包数目: (1-50)
Ping 包大小: (4-1472字节)
Ping 超时: (100-2000 毫秒)
Tracert 跳数: (1-30)
诊断结果

Diagnostic tool


In this page you can use the ping or tracert to diagnose the connection status of the router.
Parameter settings
Select operation: Ping Tracert
IP address / domain name:
Ping packet number: (1-50)
Ping Packet Size: (4-1472 bytes)
Ping timeout: (100-2000 ms)
Tracert Hops: (1-30)
Diagnostic results

Software upgrades


软件升级

通过升级本路由器的软件,您将获得新的功能。
文 件 名:
TFTP 服务器 IP:

当前软件版本:
4.18.85 Build 120530 Rel.56096n
当前硬件版本:
WR702N 1.0 00000000

注意:请使用有线LAN口连接进行软件升级。升级时请选择与当前硬件版本一致的软件。升级过程不能关闭路由器电源,否则将导致路由器损坏而无法使用。升级过程约40秒,当升级结束后,路由器将会自动重新启动。

Software upgrades


By upgrading the software of the router, you will get the new features.
File name:
TFTP server IP:

Current software version:
4.18.85 Build 120530 Rel.56096n
Current hardware versions:
WR702N 1.0 00000000

Note: Please use the wired LAN port for software upgrades. Please select consistent with the current hardware version upgrade software. The upgrade process can not turn off the power to the router, otherwise the router would be damaged and can not be used. The upgrade process is about 40 seconds after the end of the upgrade, the router will automatically restart.

Restore the factory settings


恢复出厂设置

单击此按钮将使路由器的所有设置恢复到出厂时的默认状态。

Restore the factory settings


Click this button will restore all settings of the router to the factory default state.

Backup and load the configuration file


备份和载入配置文件

您可以在这保存您的设置。我们建议您在修改配置及升级软件前备份您的配置文件。

您可以通过载入配置文件来恢复您的设置。
路 径:
注意: 1、导入配置文件后,设备中原有的用户配置将会丢失。如果您载入的配置文件有误,可能会导致设备无法被管理。
2、载入配置文件的过程不能关闭路由器电源,否则将导致路由器损坏而无法使用。载入过程约20秒,当载入结束后,路由器将会自动重新启动。

Backup and load the configuration file


You can save your settings. We recommend that you modify the configuration and upgrade software to back up your configuration files.

You can load the configuration file to restore your settings.
Path:
Note: 1, after importing the configuration file, the the equipment original user configuration will be lost. If you load the configuration file, may result in the devices can not be managed.
2, the process of loading the configuration file can not power off the router, otherwise the router would be damaged and can not be used. Loaded in about 20 seconds, when loaded after the router will automatically restart.

Restart router

重启路由器

单击此按钮将使路由器重新启动。

Restart router


Click this button will cause the router to restart.

Change Password

修改登录口令

本页修改系统管理员的用户名及口令,用户名及口令长度不能超过14个字节。
原用户名:
原口令:
新用户名:
新口令:
确认新口令:

Change Password


This page to modify the system administrator's user name and password, user name, and password length can not be more than 14 bytes.
Original user name:
Original password:
The new user name:
New password:
Confirm new password:

System log

系统日志

索引 类型 日 志 内 容
1 INFO 0000:系统启动成功.

Time = 2006-01-01 8:31:05 1865s
H-Ver = WR702N 1.0 00000000 : S-Ver = 4.18.85 Build 120530 Rel.56096n
L = 192.168.1.253 : M = 255.255.255.0
W1 = DHCP : W = 0.0.0.0 : M = 0.0.0.0 : G = 0.0.0.0
Free=5029, Busy=1, Bind=0, Inv=0/0, Bc=0/0, Dns=0, cl=384, fc=0/0, sq=0/0

System log


Log the contents of the index type
1 INFO  0000: The system startup success.

 Time = 2006-01-01 8:31:05 1865s
 H-Ver = WR702N 1.0 00000000: S-Ver = 4.18.85 Build 120530 Rel.56096n
 L = 192.168.1.253: M = 255.255.255.0
 W1 = DHCP: W = 0.0.0.0: M = 0.0.0.0: G = 0.0.0.0
 Free = 5029, Busy = 1, Bind = 0, Inv = 0/0, Bc = 0/0, Dns = 0, cl = 384, fc = 0/0, sq = 0/0

Saturday, 23 March 2013

Song of the Mariachi (Brunette of my heart) by Los Lobos

Performed by Antonio Banderas with lyrics!
http://www.youtube.com/watch?v=gXM8LjS-AOg

Mariachi - http://en.wikipedia.org/wiki/Mariachi
A performer or street musician, also denoting the style of music.

Cancion del Mariachi (Morena de Mi Corazon) by Los Lobos
Soy un hombre muy honrado,
Que me gusta lo mejor
A mujeres no me faltan,
Ni al dinero, ni el amor

jineteando en mi caballo
Por la sierra yo me voy
Las estrellas y la luna
Ellas me dicen donde voy

Ay, ay, ay, ay
Ay, ay mi amor
Ay mi morena,
De mi corazon

Me gusta tocar la guitarra
Me gusta cantar el sol
Mariachi me acompana
Quando canto mi cancion

Me gusta tomar mis copas
Aguardiente es lo mejor
Tambien el tequilla blanco
Con su sal le da sabor

Ay, ay, ay, ay
Ay, ay mi amor
Ay mi morena,
De mi corazon

Me gusta tocar la guitarra
Me gusta cantar el sol
Mariachi me acompana
Quando canto mi cancion

Me gusta tomar mis copas
Aguardiente es lo mejor
Tambien el tequilla blanco
Con su sal le da sabor

Ay, ay, ay, ay
Ay, ay mi amor
Ay mi morena,
De mi corazon

Ay, ay, ay, ay
Ay, ay mi amor
Ay mi morena,
De mi corazon


Song of the Mariachi (Brunette of my heart) by Los Lobos
I am a very honest man,
What I like best
No woman left me,
Neither money, nor love

hustling on my horse
For the mountains I go
The stars and the moon
They tell me where I go

Ay, ay, ay, ay
Oh, oh my love
Oh my brunette
From my heart

I like to play guitar
I like to sing the sun
Mariachis are my companions
When I sing my song

I like to take my glasses
Brandy is the best
Also the white tequilla
To which salt adds flavor

Ay, ay, ay, ay
Oh, oh my love
Oh my brunette
From my heart

I like to play guitar
I like to sing the sun
Mariachis are my companions
When I sing my song

I like to take my glasses
Brandy is the best
Also the white tequilla
To which salt adds flavor

Ay, ay, ay, ay
Oh, oh my love
Oh my brunette
From my heart

Ay, ay, ay, ay
Oh, oh my love
Oh my brunette
From my heart