With the advent of new wireless standards, faster microprocessors and smart sensors, it has become possible to construct wireless sensor networks with ample processing and communication capability. Our thrust in this paper is toward implementing a collaborative processing system for wireless sensor networks. A number of research groups have developed algorithms for applications such as target tracking and location, environment monitoring, and health monitoring of structures. What has been missing is a distributed sensor processing system which provides a framework for these algorithms to function. The system described here borrows heavily from the parallel processing sphere especially the Parallel Virtual Machine (PVM) system developed by ORNL. To facilitate distribution of computational resources, a new algorithm has been proposed for efficient distribution with the use of minimum system resources, in other words, determining an optimal set of nodes which can handle the distributed computation. For this purpose, we assign costs to the various parameters of interest in the network such as the node energy level, the communication energy cost/complexity and resource availability. We then arrive at a cost function by assigning suitable weights to these costs and choose only those nodes whose cost function evaluates to above a particular threshold value. Implementation of typical feature extraction algorithms such as the Discrete Fourier Transform (DFT) and the Discrete Wavelet Transform (DWT) are discussed.