I bought Kinect V2 recently. I like very much this amazing sensor.
New Kinect can be fixed to the camera mount. But, It can rotate freely in a tilting plane.
It is inconvenient if we want to use image processing using this sensor.
So, I have created a fixture to fix the neck of Kinect V2.
This time, I will introduce it.
This is the fixture. I made this fixture in CellP that is 3D printer.
CellP: http://www.cellp.jp/ (Japanese)
When fitted to the sides of Kinect V2 this fixtures, Kinect V2 will not rotate.
It is a simple idea.
As shown in the photo, white fixture looks nice to Kinect black body.
I publish the STL of this fixture.
If you liked my fixture, please try to print it.
Download: https://onedrive.live.com/redir?resid=4B529851B9DE2E2E%211150
Have a nice day with Kinect V2.
VENUS CHANNEL
This blog written about robots, programs and some hobby.
Friday, September 5, 2014
Wednesday, December 11, 2013
CGIHTTPServer: The problem that Python script does not work.
When I use CGIHTTPServer, I caught problem that Python Script did not work.
So I checked a method to solve this problem, I show the method.
The problem is the following two points.
① Web browser downloads the Python script file without it run.
② The contents of the Python script file is displayed without it run.
I shows the causes and solutions of ① and ②.
hoge.py: Represents the Python script that you want to run here.
Please try running the following command.
-rw-rw-r-- 1 ****** hoge.py
If the display as described above is, your script does not have execute permission.
You check the execute permissions using the "ls -l" command.
Then you will see that "-" turns into "x".
-rwxr-xr-x 1 ****** hoge.py
Line feed code is incorrect in the case of the following display.
hoge.py: a python\015 script, ASCII text executable, with CRLF line terminators
The following message appears if the line feed code is correct.
hoge.py: a python script, ASCII text executable
Please check the line feed cord of hoge_lf.py.
hoge_lf.py: a python script, ASCII text executable
The following message appears if the line feed code is correct.
We have fixed the line feed code.
I hope that your problem will be solved in this solutions.
So I checked a method to solve this problem, I show the method.
The problem is the following two points.
① Web browser downloads the Python script file without it run.
② The contents of the Python script file is displayed without it run.
▶ Cause and Resolution
I shows the causes and solutions of ① and ②.
hoge.py: Represents the Python script that you want to run here.
Cause of ①
It is caused by the fact that Python script does not have execute permission.Please try running the following command.
$ ls -l
-rw-rw-r-- 1 ****** hoge.py
If the display as described above is, your script does not have execute permission.
Solutions to ①
Please give execute permission to your script with the following command.$ chmod 755 hoge.py
You check the execute permissions using the "ls -l" command.
Then you will see that "-" turns into "x".
-rwxr-xr-x 1 ****** hoge.py
Cause of ②
Since there is a possibility that the line feed code is at the cause, please check it.$ file hoge.py
Line feed code is incorrect in the case of the following display.
hoge.py: a python\015 script, ASCII text executable, with CRLF line terminators
The following message appears if the line feed code is correct.
hoge.py: a python script, ASCII text executable
Solutions to ②
Please correct line feed code.$ nkf -file hoge.py > hoge_lf.py
Please check the line feed cord of hoge_lf.py.
hoge_lf.py: a python script, ASCII text executable
The following message appears if the line feed code is correct.
We have fixed the line feed code.
I hope that your problem will be solved in this solutions.
Wednesday, December 26, 2012
2D Animation in XY plane using Scatter
Hi. I write about matplotlib today.
It is a Python 2D, 3D plotting library which draw high quality figures.
matplotlib
URL: http://matplotlib.org/
Summary:
This article is written about matplotlib.
I show you how to create an animation using the scatter.
In scatter, you can update the coordinates of the points by using the set_offsets method.
I show example python script.
This script is plotting three points in xy coordinates.
Thanks you for read my page.
It is a Python 2D, 3D plotting library which draw high quality figures.
matplotlib
URL: http://matplotlib.org/
Summary:
This article is written about matplotlib.
I show you how to create an animation using the scatter.
In scatter, you can update the coordinates of the points by using the set_offsets method.
I show example python script.
This script is plotting three points in xy coordinates.
#!/usr/bin/env python # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np def _update_plot(i, fig, scat): scat.set_offsets(([0, i],[50, i],[100, i])) print('Frames: %d' %i) return scat, fig = plt.figure() x = [0, 50, 100] y = [0, 0, 0] ax = fig.add_subplot(111) ax.grid(True, linestyle = '-', color = '0.75') ax.set_xlim([-50, 200]) ax.set_ylim([-50, 200]) scat = plt.scatter(x, y, c = x) scat.set_alpha(0.8) anim = animation.FuncAnimation(fig, _update_plot, fargs = (fig, scat), frames = 100, interval = 100) plt.show()Flow of a process.
- Import the required method.
- Define a callback function.
- Instantiate the Figure Object.
- Sets the value of the X and Y.
- Instantiate the Subplot Object.
- Sets a grid and a limits of the X and Y.
- Instantiate the Scatter Object.
- Sets a Alpha Channel of the points.
- Instantiate the FuncAnimation Object.
- Start the Animation.
import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np
def _update_plot(i, fig, scat): scat.set_offsets(([0, i],[50, i],[100, i])) print('Frames: %d' %i) return scat,Note:
In instantiate scatter, value of X and Y is set [x1, x2, ..., xN], [y1, y2, ..., yN].
But in set_offsets method, you set as follows.
set_offsets(([x1, y1], [x2, y2], ...., [xN, yN]))
fig = plt.figure()
x = [0, 50, 100] y = [0, 0, 0]
ax = fig.add_subplot(111)
ax.grid(True, linestyle = '-', color = '0.75') ax.set_xlim([-50, 200]) ax.set_ylim([-50, 200])
scat = plt.scatter(x, y, c = x)x:X-axis values.
[x1, x2, ..., xN]
y:Y-axis values.
[y1, y2, ..., yN]
c:Color
It changes according to the value of the X axis.
set_offsets(([x1, y1], [x2, y2], ...., [xN, yN]))
scat.set_alpha(0.8)
anim = animation.FuncAnimation(fig, _update_plot, fargs = (fig, scat), frames = 100, interval = 100)fig: Figure Object
_update_plot: Callback Function
fargs: Value to be passed to the callback function
frams: Number of frames
interval: Call interval of the callback function
plt.show()
Thanks you for read my page.
Monday, December 24, 2012
Global value on Python
Nice to meet you!
This is my first article in my blog.
I study Robotics at University in Japan.
So I write mainly about robots and programs.
Summary:
This page is written about global value on Python.
You have to declare a 'global' to use global variables in Python.
I show some example ,and in last describe how to use global variables in class.
I show how to use simple global variables.
You can use a global variables by declaring a 'global' in the function
You can recognize that saved the value adding one to every call.
You can access a global variables from the class by putting 'self' as an example.
I recommend that you access to the global variables via the method.
This is my first article in my blog.
I study Robotics at University in Japan.
So I write mainly about robots and programs.
Summary:
This page is written about global value on Python.
You have to declare a 'global' to use global variables in Python.
I show some example ,and in last describe how to use global variables in class.
I show how to use simple global variables.
You can use a global variables by declaring a 'global' in the function
g1 = 0 def gl_test1(): global g1 print g1 gl_test1() EXECUTION RESULT 0Next I try to change the value of a global variables.
You can recognize that saved the value adding one to every call.
g2 = 0 def gl_test2(): global g2 g2 += 1 print g2 for i in range(10): gl_test2() EXECUTION RESULT 1 2 3 4 5 6 7 8 9 10Last, I show example of using global variables at Class.
You can access a global variables from the class by putting 'self' as an example.
I recommend that you access to the global variables via the method.
class GlTest(object): g = 0 def get(self): global g return self.g def add(self, x): global g self.g += x gc = GlTest() gc.get() EXECUTION RESULT 0 gc.add(100) gc.get() EXECUTION RESULT 100Thanks you for read my page.
Subscribe to:
Posts (Atom)