Hello everyone,
I have this part of my code where I am trying to traverse over an image by
running a for loop for both x and y co-ordinate axis. But the loop is
terminating by just reading first pixel. Can think of a reason why this is
happening ?
The code is:
for sy in xrange(0,
On Fri, Apr 26, 2013 at 2:39 PM, Peter Otten __pete...@web.de wrote:
inshu chauhan wrote:
I have this part of my code where I am trying to traverse over an image
by
running a for loop for both x and y co-ordinate axis. But the loop is
terminating by just reading first pixel. Can think
, 2013 at 3:15 PM, Chris Angelico ros...@gmail.com wrote:
On Fri, Apr 26, 2013 at 7:36 PM, inshu chauhan insidesh...@gmail.com
wrote:
On Fri, Apr 26, 2013 at 2:39 PM, Peter Otten __pete...@web.de wrote:
f = open(...)
in the code you are not showing with
f == list(open
i have to implement the below line in one of my code:
for p in sorted(segments.iterkeys()) and for k in
sorted(class_count.iterkeys()) and for j in sorted(pixel_count.iterkeys()):
Its giving me a syntax error which is obvious, but how can I make all three
for loop run simultaneously or any
, inshu chauhan insidesh...@gmail.com
wrote:
i have to implement the below line in one of my code:
for p in sorted(segments.iterkeys()) and for k in
sorted(class_count.iterkeys()) and for j in
sorted(pixel_count.iterkeys()):
Its giving me a syntax error which is obvious, but how can I
zip isn't doing the required
On Tue, Apr 23, 2013 at 12:28 PM, inshu chauhan insidesh...@gmail.comwrote:
Yes Simultaneously means all three running at the same time, I looked up
zip just now, but will it not disturb my dictionaries ?
And yes the dictionaries have same number of keys
Thanks Gary.
Be clearer about the problem please.
Do you wish to produce a loop that:
On pass 1, each of p,k, and t hold the first item of their respective
lists, and
on pass 2, each of p,k, and t hold the second item of their respective
lists, and
so on
until one (or all) lists
, inshu chauhan insidesh...@gmail.comwrote:
zip isn't doing the required
On Tue, Apr 23, 2013 at 12:28 PM, inshu chauhan insidesh...@gmail.comwrote:
Yes Simultaneously means all three running at the same time, I looked up
zip just now, but will it not disturb my dictionaries ?
And yes
Hello Everyone,
I am trying to work with lists and dictionaries together.
In the following code I have to access pixels in a segmented image through
a dictionary. But the problem is when I am trying to update the list
through dict it is giving me this error of tuple, ofcourse because list
indices
I have a prog in which a functions returns a dict but when I try to iterate
over the dict using iterkeys, It shows an error. I think its because only
address of the dictionary is returned so cannot be iterated upon.
Please suggest some way by which it can be made possible to iterate over
the
Hello everyone,
Here in my part of the code where cc is a dictionary. I want to understand
what actually cc.iterkeys() and cc[k] actually doing.
I am already reading
http://docs.python.org/2/library/stdtypes.html#dict.items
and http://www.tutorialspoint.com/python/python_dictionary.htm but still
I have this program which is working with 2 dictionaries segments,
class_counts.. but I am getting an error mentioned below the programme.
import cv
from itertools import *
from math import floor, sqrt, ceil
from numpy import array, dot, subtract, add, outer, argmax, linalg as lin
def
I am trying to create a dictionary with a key and its values seraching from
a data set. But something is going wrong. This is the first time I am
working with dicts.
My code is :
import cv
def Computesegclass(segimage):
num_pixel = 0
for y in xrange(0, segimage.height):
for x
I have 10 simple text files with 3 columns x,y,z delimited by space. I am
trying to combine these 10 files to get a single text file.
Eg. of data in 10 files is
299 446 2
I had written this prog for merging files:
import csv
import glob
with open(rC:\Users\inshu.chauhan\Desktop\test2.arff,
On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler r.koeb...@yahoo.de wrote:
Hi,
On Wed, Feb 20, 2013 at 10:50:54AM +0100, inshu chauhan wrote:
I have 10 simple text files with 3 columns x,y,z delimited by space. I
am
trying to combine these 10 files to get a single text file.
Eg
On Wed, Feb 20, 2013 at 11:38 AM, inshu chauhan insidesh...@gmail.comwrote:
On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler r.koeb...@yahoo.dewrote:
Hi,
On Wed, Feb 20, 2013 at 10:50:54AM +0100, inshu chauhan wrote:
I have 10 simple text files with 3 columns x,y,z delimited by space
On Wed, Feb 20, 2013 at 12:04 PM, Dave Angel da...@davea.name wrote:
On 02/20/2013 05:38 AM, inshu chauhan wrote:
On Wed, Feb 20, 2013 at 11:26 AM, Roland Koebler r.koeb...@yahoo.de
wrote:
snip
If you only want to concat the files, I would use some shell-tools,
like cat on Linux
Here is my attempt to merge 10 files stored in a folder into a single file :
import csv
with open(C:\Users\inshu.chauhan\Desktop\test.arff, w) as w:
writer = csv.writer(w)
for f in glob.glob(C:\Users\inshu.chauhan\Desktop\For
Model_600\*.arff):
rows = open(f, r).readlines()
On Tue, Feb 19, 2013 at 4:54 PM, MRAB pyt...@mrabarnett.plus.com wrote:
On 2013-02-19 15:27, inshu chauhan wrote:
Here is my attempt to merge 10 files stored in a folder into a single
file :
import csv
with open(C:\Users\inshu.chauhan\**Desktop\test.arff, w) as w:
writer
In the programme below I am trying to read two csv format files and process
them and write a new file with some of theirs data.
import csv
f1_reader = csv.reader(open(rZ:\Weka
work\Feature_Vectors_Fullset_00.arff))
f2_reader = csv.reader(open(rZ:\Weka
On Mon, Feb 11, 2013 at 1:26 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
inshu chauhan wrote:
In the programme below I am trying to read two csv format files and
process them and write a new file with some of theirs data.
import csv
f1_reader = csv.reader(open(rZ
On Mon, Feb 11, 2013 at 2:02 PM, MRAB pyt...@mrabarnett.plus.com wrote:
On 2013-02-11 12:44, inshu chauhan wrote:
On Mon, Feb 11, 2013 at 1:26 PM, Steven D'Aprano
steve+comp.lang.python@**pearwood.infosteve%2bcomp.lang.pyt...@pearwood.info
mailto:steve+comp.lang.**pyt...@pearwood.infosteve
On Mon, Feb 11, 2013 at 3:22 PM, Dave Angel da...@davea.name wrote:
On 02/11/2013 06:00 AM, inshu chauhan wrote:
In the programme below I am trying to read two csv format files and
process
them and write a new file with some of theirs data.
import csv
f1_reader = csv.reader(open(rZ:\Weka
Hello all,
I am trying to run a small code of mine but I am getting a run time error.
What is actually meant by run time error ? it is saying to contact
programme administrator something. Why one would get this error ? and how
to remove it ?
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Feb 5, 2013 at 3:10 PM, Roy Smith r...@panix.com wrote:
In article mailman.1366.1360073151.2939.python-l...@python.org,
inshu chauhan insidesh...@gmail.com wrote:
Hello all,
I am trying to run a small code of mine but I am getting a run time
error.
What is actually meant
On Mon, Jan 28, 2013 at 6:05 PM, Dennis Lee Bieber wlfr...@ix.netcom.comwrote:
On Mon, 28 Jan 2013 14:31:31 +0100, inshu chauhan
insidesh...@gmail.com declaimed the following in
gmane.comp.python.general:
In the code below I am trying to read 2 files f1 and f2 , extract some
data
from
On Wed, Jan 30, 2013 at 2:23 PM, Dave Angel d...@davea.name wrote:
On 01/30/2013 05:43 AM, inshu chauhan wrote:
On Mon, Jan 28, 2013 at 6:05 PM, Dennis Lee Bieber wlfr...@ix.netcom.com
wrote:
On Mon, 28 Jan 2013 14:31:31 +0100, inshu chauhan
insidesh...@gmail.com declaimed the following
In the code below I am trying to read 2 files f1 and f2 , extract some data
from them and then trying to write them into a single file that is 'nf'.
import cv
f1 = open(rZ:\modules\Feature_Vectors_300.arff)
f2 = open(rZ:\modules\Feature_Vectors_300_Pclass.arff)
nf = open(rZ:\modules\trial.arff,
Yes Chris, I understand, My Original code was
for l in f1:
sp = l.split(,)
if len(sp)!= 12:
continue
else:
ix = sp[0].strip()
iy = sp[1].strip()
for s in f2:
st = s.split(,)
if len(st)!= 11:
continue
else:
In that case, Dave's suggestion to read into a list and iterate over
the list is to be strongly considered. But I'm not entirely sure what
your goal is here. Are you trying to make the Cartesian product of the
two files, where you have one line in the output for each possible
pair of matching
Your current logic tries to scan through the first file, and for each line
that has 12 elements, scans through the entire second file. It fails to
actually do it, because you never do a seek on the second file.
Now it appears your requirement is entirely different. I believe you have
two
That's zip not Zip
Have you tried looking at the docs? Or even typing help(zip) at the
python interpreter prompt?
In rough terms, zip takes one element (line) from each of the iterators,
and creates a new list that holds tuples of those elements. If you use it
in this form:
Here I have a code which basically reads a csv file, tries to compare the
last 2 items in each line of the file.
f = open(rZ:\modules\Feature_Vectors_300_Pclass.arff)
for l in f:
sp = l.split(,)
if len(sp) != 11:
print of, l,
else:
#print sp[9], sp[10]
if
at the
end.
To remove those unwanted characters you could use the strip() function.
So your code could be:
if sp[9].strip() == sp[10].strip():
print Same class
else:
print Different class
At least this works for me when I tried it...
Am 24.01.2013 11:37, schrieb inshu chauhan:
Here I
Thanks a lot people.. :).. :)
On Thu, Jan 24, 2013 at 1:10 PM, Tobias M. t...@tobix.eu wrote:
Am 24.01.2013 13:02, schrieb Chris Angelico:
On Thu, Jan 24, 2013 at 10:58 PM, Tobias M. t...@tobix.eu wrote:
Chris Angelico wrote:
I'd not consider the performance, but the correctness. If
if-else doesn't define a loop, but each of the for statements do.
You have defined a classification for 8 of the possible colors, leaving
millions of them undefined. If the first time through the loop you
manage to hit one of those undefined ones, you'll have no value for
classification.
In this code :
import cv
g = open(PointCloudmitClass.txt, w)
image = cv.LoadImageM(Z:/modules/intensity_01.tif,
cv.CV_LOAD_IMAGE_UNCHANGED)
print image
for y in xrange(0,image.height):
for x in xrange(0,image.width):
color = image[y,x]
if color == (0.0,0.0,0.0):
Yes i tried or also but no use .
Explain no use. If you mean you still fail, then what else did you
try? For example, did you try interchanging the two subscripts? I've
suspected all along that the meanings of row and column, x and y, [0]
and [1], height and width are possibly
def GenerateRing(x,y, N): Generates square rings around a point in data
which has 300 columns(x) and 3000
rows(y)
indices = []
for i in xrange(-N, N):
indices.append((x+i, y-N))
indices.append((x+N, y+i))
indices.append((x-i, y+N))
I guess I have to use try and except as Chris suggested, this isn't working.
--
http://mail.python.org/mailman/listinfo/python-list
thanx ..I understand the problem now..
On Wed, Nov 14, 2012 at 7:48 PM, MRAB pyt...@mrabarnett.plus.com wrote:
On 2012-11-14 15:18, inshu chauhan wrote:
for this code m getting this error :
CODE :
def ComputeClasses(data):
radius = .5
points = []
for cy in xrange(0
I did the following changes in this part of my programme.. now the
refereence error is removed but its showing me another error :
def ComputeClasses(data):
radius = .5
points = []
for cy in xrange(0, data.height):
for cx in xrange(0, data.width):
if data[cy,cx] ==
...@davea.name wrote:
On 11/20/2012 07:31 AM, inshu chauhan wrote:
I did the following changes in this part of my programme.. now the
refereence error is removed but its showing me another error :
def ComputeClasses(data):
radius = .5
points = []
for cy in xrange(0
def distance(c, p):
dist = sqrt(
((c[0]-p[0])**2) +
((c[1]-p[1])**2) +
((c[2]-p[2])**2)
)
return dist
def GenerateRing(x,y, N): Generates square rings around a point in data
which has 300 columns(x) and 3000 rows(y)
indices = []
for
I am using python 2.7.3 , so can it be done in that ?
On Tue, Nov 20, 2012 at 2:48 PM, Chris Angelico ros...@gmail.com wrote:
On Wed, Nov 21, 2012 at 12:43 AM, inshu chauhan insidesh...@gmail.com
wrote:
I need help in this part as I am unable to device a method in which if
the
points
On Tue, Nov 20, 2012 at 3:00 PM, Chris Angelico ros...@gmail.com wrote:
On Wed, Nov 21, 2012 at 12:57 AM, inshu chauhan insidesh...@gmail.com
wrote:
I am using python 2.7.3 , so can it be done in that ?
(Please don't top-post; just delete the couple of blank lines that
gmail oh so kindly
def GenerateRing(x,y, N): Generates square rings around a point in data
which has 300 columns(x) and 3000 rows(y)
indices = []
for i in xrange(-N, N):
indices.append((x+i, y-N))
indices.append((x+N, y+i))
indices.append((x-i, y+N))
So did you read the following paragraphs? You should not be using and
in that expression.
Yes i tried or also but no use .
You do not want and in that expression. The way you've coded it,
it'll only skip items in which both indices are out of range. Change
it to
The catch to the approach suggested by Chris is that you DON'T want to
break out of the whole loop when one value is out of range. You only
want to skip that one point.
Yes I want to skip only that one point (centre) but try and expect seems
to be the last option.. I would like to try other
I dont want error actually to come. With try nd except , the error will
come but without affecting my prog...
--
http://mail.python.org/mailman/listinfo/python-list
for this code m getting this error :
CODE :
def ComputeClasses(data):
radius = .5
points = []
for cy in xrange(0, data.height):
for cx in xrange(0, data.width):
if data[cy,cx] != (0.0,0.0,0.0):
centre = data[cy, cx]
No answers for my question ?? :O
--
http://mail.python.org/mailman/listinfo/python-list
http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and
imported it using from notzanzibar import DataType.
No i haven't downloaded it.. and this site is not opening...
Then you'd have instantiated it in some code like
data = DataType(filename)
and then the type of data
I attached a wrong file...Right file is attached here
On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan insidesh...@gmail.comwrote:
http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and
imported it using from notzanzibar import DataType.
No i haven't downloaded
Please Ignore the above two files attached,,, See this one
On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan insidesh...@gmail.comwrote:
I attached a wrong file...Right file is attached here
On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan insidesh...@gmail.comwrote:
http
Actually this one.. and its the last..
On Fri, Nov 9, 2012 at 2:59 PM, inshu chauhan insidesh...@gmail.com wrote:
Please Ignore the above two files attached,,, See this one
On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan insidesh...@gmail.comwrote:
I attached a wrong file...Right file
Actually data is neither a zanzibar nor a class nor a list.. its a yml
image. with pixels
I am trying to access pixels of a 3D image through this programme..
On Tue, Nov 6, 2012 at 8:59 PM, woooee woo...@gmail.com wrote:
From this line, data appears to be a class
if 0 ix data.width
I am getting this error while running my programme.. :
error: index is out of range
I cannot find a valid reason for it in my prog can somebody suggest what
may be possible reasons for this error..
The part of the code is :
def addpoints (data, points, ix, iy): # makes a list of relevant
what is the difference between range and xrange.. both seem to work the
same. ? And which should be used where and in what situations.. ??
--
http://mail.python.org/mailman/listinfo/python-list
How to load a yml file in python and work with it ??
I used : import cv
data = cv.Load(Z:/data/xyz_0_
300.yml)
But when I print data.. it just gives the detail of the image like number
of rows and columns etc
I want read what is there in the pixel of the image..
I tried to
-- Forwarded message --
From: inshu chauhan insidesh...@gmail.com
Date: Thu, Nov 1, 2012 at 1:26 PM
Subject: Re: python and Open cv
To: Mark Lawrence breamore...@yahoo.co.uk
I am sorry.. but I need to know what are the rules and what about gmail ??
Many people are using gmail
what is the most pythonic way to do this :
if 0 ix 10 and 0 iy 10 ???
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Nov 1, 2012 at 7:02 PM, Paul Rudin paul.nos...@rudin.co.uk wrote:
Zero Piraeus sche...@gmail.com writes:
There aren't any rules about gmail (except the unwritten rule that to
be a real geek you need to use a mail client that takes a whole
weekend to configure, and another three
OK ..I got it..
On Thu, Nov 1, 2012 at 5:54 PM, Zero Piraeus sche...@gmail.com wrote:
:
On 1 November 2012 11:32, inshu chauhan insidesh...@gmail.com wrote:
what is the most pythonic way to do this :
if 0 ix 10 and 0 iy 10 ???
As everyone else has said, it's
How to load a yml file in python and work with it ??
I used : import cv
data = cv.Load(Z:/data/xyz_0_300.yml)
But when I print data.. it just gives the detail of the image like number
of rows and columns etc
I want read what is there in the pixel of the image.. can somebody
item
which should print:
[1,2,3]
[4,5,6]
On Tue, Oct 23, 2012 at 10:10 PM, inshu chauhan insidesh...@gmail.comwrote:
ok I got it guys...
On Tue, Oct 23, 2012 at 10:08 PM, Joshua Landau
joshua.landau...@gmail.com wrote:
On 23 October 2012 21:06, Joshua Landau joshua.landau
clist = alist, blist
This may work i guess becuase i want list within list [ [1,2,3] , [4,5,6]]
or if the clist initial contents were relevant, perhaps you mean
clist += alist, blist
But not this because it will simply concatenate the list like
[1,2,3,4,5,6] .. I dont want this
or if the clist initial contents were relevant, perhaps you mean
clist += alist, blist
But not this because it will simply concatenate the list like
[1,2,3,4,5,6] .. I dont want this actaully...
No, it won't. Try it to see
Ok but it should be clist + = [alist, blist ]
Is this what you mean:
list_1 = [i for i in range(0,5)]
list_2 = [i for i in range(5,11)]
for i in list_2:
... list_1.append(i)
...
list_1
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
or would another example help you out more?
No but really sorry this is what I DONT WANT...
The
Yes Dave ..You are right and my problem is solved now.. Thanx to all...
On Thu, Oct 25, 2012 at 11:55 AM, David Hutto dwightdhu...@gmail.comwrote:
On Thu, Oct 25, 2012 at 5:51 AM, inshu chauhan insidesh...@gmail.com
wrote:
Is this what you mean:
list_0 = []
list_1 = [i for i
On Thu, Oct 25, 2012 at 12:04 PM, David Hutto dwightdhu...@gmail.comwrote:
On Thu, Oct 25, 2012 at 5:58 AM, inshu chauhan insidesh...@gmail.com
wrote:
Yes Dave ..You are right and my problem is solved now.. Thanx to all...
On Thu, Oct 25, 2012 at 11:55 AM, David Hutto dwightdhu
On Thu, Oct 25, 2012 at 12:17 PM, David Hutto dwightdhu...@gmail.comwrote:
On Thu, Oct 25, 2012 at 6:12 AM, inshu chauhan insidesh...@gmail.com
wrote:
On Thu, Oct 25, 2012 at 12:04 PM, David Hutto dwightdhu...@gmail.com
wrote:
On Thu, Oct 25, 2012 at 5:58 AM, inshu chauhan insidesh
I was just trying out a programme for learning classes in python
The prog below is showing an error which it should not show :
class Bag:
def __init__(self, x):
self.data = []
def add(self, x):
self.data.append(x)
def addtwice(self, x):
self.add(x)
I was just trying out a programme for learning classes in python
The prog below is showing an error which it should not show :
class Bag:
def __init__(self, x):
self.data = []
You do nothing with x here. Right so x shouldnot be in the argument.
Fine
*class Bag:
def
but result is same as the number passed for
adding twice
On Wed, Oct 24, 2012 at 2:55 PM, Dave Angel d...@davea.name wrote:
On 10/24/2012 08:11 AM, inshu chauhan wrote:
I was just trying out a programme for learning classes in python
The prog below is showing an error which it should
ok.. This was an example i was trying to run from
http://docs.python.org/tutorial/classes.html ...
On Wed, Oct 24, 2012 at 3:48 PM, Chris Angelico ros...@gmail.com wrote:
On Thu, Oct 25, 2012 at 12:02 AM, inshu chauhan insidesh...@gmail.com
wrote:
I changed the programme
I am having a problem,
I have a class which return me a list. I want to append another list using
this list outside the Class.
can i do it ? if yes how ?
And can i use Userlist function for this ??
--
http://mail.python.org/mailman/listinfo/python-list
:
On 2012-10-24, at 7:37 AM, inshu chauhan insidesh...@gmail.com wrote:
I am having a problem,
I have a class which return me a list. I want to append another list
using this list outside the Class.
can i do it ? if yes how ?
And can i use Userlist function for this ??
--
http
the class is returning the list , and i want to append the list outside
the class... main problem is this
What do you mean the class is returning the list? Do you mean that a
class stores a list internally and you want to be able to mutate that list?
Do you mean that you have a class method
-- Forwarded message --
From: Zero Piraeus sche...@gmail.com
Date: Tue, Oct 23, 2012 at 11:14 AM
Subject: Re: can we append a list with another list in Python ?
To: inshu chauhan insidesh...@gmail.com
:
On 23 October 2012 05:01, inshu chauhan insidesh...@gmail.com wrote
Thankyou.. but my problem is different than simply joining 2 lists and it
is done now :)
On Tue, Oct 23, 2012 at 11:38 AM, Joshua Landau
joshua.landau...@gmail.comwrote:
On 23/10/2012, inshu chauhan insidesh...@gmail.com wrote:
can we append a list with another list in Python ? using
ok I got it guys...
On Tue, Oct 23, 2012 at 10:08 PM, Joshua Landau
joshua.landau...@gmail.comwrote:
On 23 October 2012 21:06, Joshua Landau joshua.landau...@gmail.comwrote:
On 23 October 2012 21:03, Joshua Landau joshua.landau...@gmail.comwrote:
On 23 October 2012 12:07, Jean-Michel
I am new to python and have a little problem to solve .. i have an
array with x, y, z co-ordinates in it as a tuple. I am trying to find
the distance between each point and sorting the points according to
the min distance.. i have tried a prog but m stuck bcoz of this error
which I am unable to
in this prog I have written a code to calculate teh centre of a given 3D data..
but i want to calculate it for every 3 points not the whole data, but
instead of giving me centre for every 3 data the prog is printing the
centre 3 times...
import cv
from math import floor, sqrt, ceil
from numpy
84 matches
Mail list logo